Hi Nakul, some of the most frequently used browser commands in Selenium Webdriver are as follows:
-
get(String arg0): In WebDriver, this method loads a new web page in the existing browser window. It accepts String as parameter and returns void. For Eg. driver.get("www.facebook.com")
-
getCurrentUrl(): In WebDriver, this method fetches the string representing the Current URL of the current web page. It accepts nothing as parameter and returns a String value. For eg. String CurrentUrl = driver.getCurrentUrl()
-
getPageSource(): In WebDriver, this method returns the source code of the current web page loaded on the current browser. It accepts nothing as parameter and returns a String value. For eg. String PageSource = driver.getPageSource()
-
close(): This method terminates the current browser window operating by WebDriver at the current time. If the current window is the only window operating by WebDriver, it terminates the browser as well. This method accepts nothing as parameter and returns void. For eg. driver.close()
-
quit(): This method terminates all windows operating by WebDriver. It terminates all tabs as well as the browser itself. It accepts nothing as parameter and returns void. For eg. driver.quit()