After the invention of Selenium, it has undergone many changes and additions to enhance the functionalities and to make it more user friendly. Selenium webdriver is the latest addition to the selenium testing suite and it has made testing using Selenium much easier. Many of its salient features makes the tool highly user-friendly and faster than ever before. Methods in Selenium is one such feature which makes the life of testers easier. Here is an overview on Selenium webdriver methods.
Selenium WebDriver Methods
This is used for loading a new web page in the current window. The method will be blocked till the loading is over.
get Current Url()
When there is a necessary to get a string of current URL used in the current window, this method will be used.
This method can be used for getting the title of the current web page
This can be used to find all the elements using the given mechanism
Syntax: findElements(By by)
This method can be used to find the first element in the web page using the given mechanism.
Syntax: WebElement findElement (by by)
When you need to get the source of the current page, this can be used.
When you need to close only the current window, this method can be used. If multiple windows are open, it will close only the current window.
Syntax: void close()
When you use this method, all the opened windows will get closed and this can be used for quitting driver instance.
Syntax: void quit()
This can be used for returning a set of window handles which will be useful for iterating over all the open windows.
Syntax: Set getWindowHandles()
This can be used for switching to a window at a later date.
Syntax: String getWindowHandle()
Using this method the history of the browser can be accessed and can navigate to the desired url.
Syntax: WebDriver.Navigation navigate()
This can be used to get option interface.