We will look in detail for each of the webdriver methods that we have. The first that we use is 'driver.get(url)' after starting the browser.
When we get the driver object, the below are the methods that we can perform operation on a driver. In IDE like eclipse, when we add period (. ) you will show all the below methods.
Method Name :- get()
Purpose: It will load a new web page in the current browser window. This is done using an http get operation, and the method will block until the load is complete.
Parameters: URL - The URL to load and it should be a fully qualified URL
Method Name: getCurrentUrl()
Purpose: Gets a string representing the current URL that the browser is opened.
Returns: The URL of the page currently loaded in the browser
Method Name: getTitle()
Purpose: Gets the title of the current web page.
Returns: The title of the current page, with leading and trailing white space stripped, or null if one is not already set
Method Name: findElements()
Syntax: findElements(By by)
Purpose: Find all elements within the current page using the given mechanism.
Parameters: By - The locating mechanism to use
Returns: A list of all WebElements, or an empty list if nothing matches
Method Name: findElement()
Syntax: WebElement findElement(By by)
Purpose: Find the first WebElement using the given method.
Parameters: By - The locating mechanism
Returns: The first matching element on the current page
Throws: NoSuchElementException - it will return exception if no matching elements are found
Method Name: getPageSource()
Returns: The source of the current page
Method Name: close()
Syntax: void close()
Purpose: Close the current window, if there are multiple windows, it will close the current window which is active and quits the browser if it's the last window opened currently.
Method Name: quit()
Syntax: void quit()
Purpose: Quits this driver instance, closing every associated window which is opened.
Method Name: getWindowHandles()
Purpose: Return a set of window handles which can be used to iterate over all the open windows of this Webdriver instance by passing them to switchTo().WebDriver.Options.window()
Returns: A set of window handles which can be used to iterate over all the open windows.
Method Name: getWindowHandle()
Syntax: String getWindowHandle()
Parameter: Return an opaque handle to this window that uniquely identifies it within this driver instance. This can be used to switch to this window at a later date
The next future commands will be performed to a different frame or window.
Returns: A Target Locator which can be used to switch or select a frame or window
Method Name: navigate()
Syntax: WebDriver.Navigation navigate()
Purpose: An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
Returns: A WebDriver.Navigation that allows the selection of what to do next
Method Name: manage()
Syntax: WebDriver.Options manage()
Purpose: Gets the Option interface
Returns: An option interface