Subscribe Us

How To Click on Browser Back Button In Selenium Webdriver

.
Question : How To Click on Browser Back Button In Selenium Webdriver Using Java ?

Answer :
By using back() method we click on browser back button. 

back()
back() is a navigation method in selenium used to click on browser back button .

Syntax
back();

Example 
driver.navigate().back();


Selenium Code to click on browser back button using java


package automation;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class BackMethod 
{
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", "C:\\Software\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
driver.navigate().back();
}
}

In this tutorial we learn how to Click Browser back button in selenium webdriver .Hope this tutorial helpful for you 😊

Thanks & Regards 
Sandeep Yadav

Important Tags : how to click browser back button , how to click on browser back button in selenium webdriver using java , how to click on browser back button in selenium 


How To Click on Browser Back Button In Selenium Webdriver




Post a Comment

0 Comments