SEMrush

Top 10 Selenium Webdriver Browser Commands

 Selenium Webdriver - Commands in a nutshell
Selenium Webdriver Commands
Command
Example
Purpose

get() driver.get("www.richasd.blogspot.com"); Opens a new web page in the current browser

refresh() driver.navigate().refresh();  Refresh the current browser

refresh() driver.findElement(By.name("abc")).sendKeys(Keys.F5);  Refresh the current browser

refresh() driver.get(driver.getCurrentUrl());  Refresh the current browser

refresh() driver.navigate().to(driver.getCurrentUrl());  Refresh the current browser

refresh() driver.findElement(By.name("abc")).sendKeys("\uE035");  Refresh the current browser

getTitle() driver.getTitle();  Gets the title of the current page

getCurrentUrl() driver.getCurrentUrl(); Gets the URL of the page currently loaded in the browser

getPageSource() driver.getPageSource(); Gets the source of the last loaded page

close(); driver.close(); Closes the current window of the browser, if it’s the last window it will close the browser.

quit() driver.quit();  Quit the browser and all the opened windows in the browser

Next >