The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

Browser Back & Forward in selenium webdriver

while testing application if you get a scenario of browser back and Forward then how you will handle it in automation script. when I was writing automation script, I am get multiple scenario of browser back and forward in my application testing for that  I am using below code in our script.


Follow below step:
1. Create Driver for any Browser(Mozilla)
2. Go to the URL
3. Navigate to some page in website.
4. Use Selenium code to Navigate Back to Main Page.

public void  browserBack(){

public static void main(String args[]){
WebDriver driver =new FirefoxDriver();
driver.get("http://seleniumhq.org/");
driver.findElement(By.linkText("Download")).click();
Thread.sleep(3000);            //delay in time
driver.navigate().back();
Thread.sleep(3000);            //delay in time
driver.navigate().forward();
        }
}

No comments

Post a Comment

Powered by Blogger.