WebDriver Methods
Methods inside WebDriver
Last updated
Was this helpful?
Methods inside WebDriver
Last updated
Was this helpful?
Now we know WebDriver object is a java object representation of the browser, we can use methods inside it and interact with our web browser.
This is the method that we user to open a URL in the browser.
This method accept a string parameter which will be the URL the we want to open
URL should be well structured (meaning with the protocol either http:// or https://)
Example:
This method return the current URL that is open in the browser as String.
Example:
This method returns the title of the current page that is opened in the browser.
This will be the value of <title>
tag inside the <head>
section of the current page source.
This method with return the whole html of the page as String.
This method helps navigating in the browser based on it's history. Like forward, back, refresh, navigating to some URL etc.,)
This method closes the main window but it'll not close other windows.
This method closes all open windows.
This method finds the particular element in the page which matches the given locator mechanism mention inBy
.
If the specified locator mechanism is matching more than one element then Selenium will always selects the first one to appear in the page source.
This method finds the list of all elements in the page which matches the given locator mechanism mention inBy
.
Example:
Example:
Example:
Example:
Example:
To know more about locators