About Lesson
WebDriver Methods
There are multiple methods available in WebDriver that you can use in the scripts to control and interact with the browser. Some of the methods and it’s description are as follows in table format:
Â
WebDriver Method | Method Description |
get(URL) | This method opens the specified URL in the browser during automation. |
forward() | This method simulates the browser forward button. This method navigates to the next web page. |
back() | This method simulates the browser’s back button and navigates to the previous web page in the browser’s history. |
close() | The close() method closes the current instance of the browser. |
quit() | The quit() method closes all the browser windows, including the current instance. |
findElement(By) | This method returns the first web element returned by the By locator. If no element is on the page, the NoSuchElementException exception is raised. If there are multiple matches, consider using the below method. This method will only return the first element. |
findElements(By) | The findElements() method returns all the web elements that match the locator criteria. If there is no element, it returns an empty list. |