package learing;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class IframeTest {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://tinyurl.com/cb3lbho");
Thread.sleep(5000L);
try {
List<WebElement> AlliFrameID = driver.findElements(By.tagName("iframe"));
System.out.println(AlliFrameID.size());
for(int i=0;i<=AlliFrameID.size();i++){
System.out.println(AlliFrameID.get(i).getAttribute("id"));
}
} catch (Exception e) {
driver.switchTo().frame("ifrm");
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[2]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[3]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[3]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[3]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.switchTo().defaultContent();
driver.findElement(By.xpath("//*[@id='testForm']/p/input[1]")).sendKeys("Online selenium Training");
driver.findElement(By.xpath("//*[@id='testForm']/p/input[2]")).click();
}
}
}
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class IframeTest {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://tinyurl.com/cb3lbho");
Thread.sleep(5000L);
try {
List<WebElement> AlliFrameID = driver.findElements(By.tagName("iframe"));
System.out.println(AlliFrameID.size());
for(int i=0;i<=AlliFrameID.size();i++){
System.out.println(AlliFrameID.get(i).getAttribute("id"));
}
} catch (Exception e) {
driver.switchTo().frame("ifrm");
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[2]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[3]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[3]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.findElement(By.xpath("//*[@id='ifrmTest']/p[3]/input")).click();
System.out.println(driver.findElement(By.xpath("//*[@id='ifrmTest']/p[1]/input")).getAttribute("value"));
driver.switchTo().defaultContent();
driver.findElement(By.xpath("//*[@id='testForm']/p/input[1]")).sendKeys("Online selenium Training");
driver.findElement(By.xpath("//*[@id='testForm']/p/input[2]")).click();
}
}
}
Hi Reddy Nice blog.Really it is helping for the people who are new to selenium.Thanks alot.keep up the good work
ReplyDeleteThanks Renuka...........
ReplyDelete