We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Browser Commands
The very basic browser operations of WebDriver include opening a browser,perform few tasks and then closing the browser. Given are some of the most commonly used Browser commands for Selenium WebDriver.
This command opens the get() specified URL in the browser driver.get(“https://www.google.com”) Accepts String as a parameter Returns nothing. instance The command is used to retrieve getTitle() the title of the webpage the user is String Title = driver.getTitle(); Accepts nothing as a parameter Returns a String value. currently working on. This method fetches the string String CurrentUrl = driver. getCurrentUrl() representing the Current URL Accepts nothing as a parameter Returns a String value. getCurrentUrl(); which is opened in the browser This method returns the Source String PageSource = driver. getPageSource() Accepts nothing as a parameter Returns a String value. Code of the page. getPageSource(); This method terminates the close() current browser window operating driver.close() Accepts nothing as a parameter Returns nothing. by WebDriver at the current time. This method terminates all windows operating by WebDriver. quit() driver.quit() Accepts nothing as a parameter Returns nothing. It terminates all tabs as well as the browser itself. The command helps us switch to the newly opened window and String handle=driver. getWindowHandle() Accepts nothing as a parameter Returns String Type performs actions on the new getWindowHandle(); window The command is similar to that of “getWindowHandle()” with the subtle difference that it helps to Set<String> handles=driver. Returns Set<String> getWindowHandles() Accepts nothing as a parameter deal with multiple windows i.e. getWindowHandles(); Type when we have to deal with more than 2 windows.