Browser navigation
Navigate to
The first thing you will want to do after launching a browser is to open your website. This can be achieved in a single line:
//Convenient
driver.get("https://selenium.dev");
//Longer way
driver.navigate().to("https://selenium.dev");
driver.get("https://www.selenium.dev/selenium/web/index.html")
//Convenient
driver.Url = "https://selenium.dev";
//Longer
driver.Navigate().GoToUrl("https://selenium.dev");
driver.navigate.to 'https://www.selenium.dev/'
driver.get 'https://www.selenium.dev/'
expect(driver.current_url).to eq 'https://www.selenium.dev/'
//Convenient
await driver.get('https://www.selenium.dev');
//Longer way
await driver.navigate().to("https://www.selenium.dev/selenium/web/index.html");
//Convenient
driver.get("https://selenium.dev")
//Longer way
driver.navigate().to("https://selenium.dev")
Back
Pressing the browser’s back button:
//Back
driver.navigate().back();
driver.back()
//Back
driver.Navigate().Back();
driver.navigate.back
//Back
await driver.navigate().back();
driver.navigate().back()
Forward
Pressing the browser’s forward button:
//Forward
driver.navigate().forward();
driver.forward()
//Forward
driver.Navigate().Forward();
driver.navigate.forward
//Forward
await driver.navigate().forward();
driver.navigate().forward()
Refresh
Refresh the current page:
//Refresh
driver.navigate().refresh();
driver.refresh()
//Refresh
driver.Navigate().Refresh();
driver.navigate.refresh
//Refresh
await driver.navigate().refresh();
driver.navigate().refresh()