19.2.1| getPageSource
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
parameters
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.
19.2.2| navigate
Simulates browser back, forward, refresh and navigate to options.
Syntex WebDriver.Navigation navigate()
parameters
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.
19.2.3| getWindowHandles
Returns all browser windows of the WebDriver instance.
Syntex java.util.Set<java.lang.String>
parameters
returns A set of window handles which 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.
19.2.4| getWindowHandle
Returns the currently active browser window of the WebDriver instance.
Syntex java.lang.String getWindowHandle()
parameters
returns Returns the currently active window
handle.
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.
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
parameters
returns The page source of the current page
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.
19.2.2| navigate
Simulates browser back, forward, refresh and navigate to options.
Syntex WebDriver.Navigation navigate()
parameters
returns A WebDriver.Navigation that allows the
selection of what to do next
19.2.3| getWindowHandles
Returns all browser windows of the WebDriver instance.
Syntex java.util.Set<java.lang.String>
parameters
returns A set of window handles which can be used
to iterate over all the open windows.
19.2.4| getWindowHandle
Returns the currently active browser window of the WebDriver instance.
Syntex java.lang.String getWindowHandle()
parameters
returns Returns the currently active window
handle.