Returns the page source of the last loaded page. The page source returned is a representation of the underlying DOM. It may not be formatted or escaped in the same way as the response sent from the server.
Syntex java.lang.String getPageSource
returns The page source of the current page
Write a code to open testinganswers.com and retrieve its page source
Note: If the page is modified after page reload (e.g. page refresh after selecting some list box option), then there is no guarantee that the returned page source text is of the reloaded page. WebDriver documentation can be referenced to know the exact behavior of the specific driver.
Simulates browser back, forward, refresh and navigate to options.
Syntex WebDriver.Navigation navigate()
returns A WebDriver.Navigation that allows the
selection of what to do next
This method allows WebDriver test script to simulate user interactions with browsers such as navigating to specific URL, clicking on browser back or forward button, clicking on browser refresh button, etc.
Returns all browser windows of the WebDriver instance.
returns A set of window handles that can be used to iterate over all the open windows.
Suppose the user opens testinganswers.com and then clicks on the link available on the site in another/ new window. So, see how to handle all windows and perform an action on all the windows (Driver instances) in Selenium.
Returns the currently active browser window of the WebDriver instance.
Syntex java.lang.String getWindowHandle()
returns Returns the currently active window
Suppose the user opens testinganswers.com and then clicks on the link available on the site in another/ new window. So, see how to handle both windows and perform an action on both windows (Driver instances) in Selenium.