Browser Back and Forward (NAVIGATION)
Follow the below steps for backward and forward navigation:
WebDriver driver =new FirefoxDriver();
driver.get("http://seleniumhq.org/");
driver.findElement(By.linkText("Download")).click();
Thread.sleep(3000); //delay for 3 second
driver.navigate().back();
driver.navigate().forward();
Handling Drag and Drop
Actions act = new Actions(driver);
WebElement src = driver.findElement(By.xpath("//div[@id='items']/div[1]"));
WebElement tar = driver.findElement(By.id("trash"));
act.clickAndHold(src).build().perform(); //For each action we need to build and Perform
act.moveToElement(tar).build().perform();
act.release(tar).build().perform();
Handling Frame
driver.get("http://timesofindia.indiatimes.com/");
driver.manage().timeouts().implicitlyWait(30,TimeUnit.Seconds);
List frms= driver.findElements(By.tagName("iframe")); //Frame List
System.out.println(frms.size());
for(int i=0;i
{
System.out.println(frms.get(i).getAttribute("src"));
}
for(int i=0;i
{
System.out.println(frms.get(i).getAttribute("src"));
}
No comments:
Post a Comment