In my project there is an iframe whose id is changed every time we click on that
I tried numerous ways to work on that
1) List<WebElement> frameList=driver.findElements(By.tagName("iframe"));
System.out.println(frameList.size());
for(int i =0; i<(frameList.size());i++){
driver.switchTo().frame(i);
System.out.println(i);
try{
driver.findElement(By.id("TextBox_4")).sendKeys("987654321");
System.out.println("Element found");
}
catch (NoSuchElementException e){
System.out.println("Element not found");
}
//this will check element in iframe.
2) WebElement frame =
driver.findElement(By.xpath("//div[contains(@id,'title')]"));
driver.switchTo().frame(frame);
// this search frame using xpath and contains keyword but its showing element not found exception
3) int frameSize = driver.findElements(By.tagName("iframe")).size();
System.out.println(frameSize);
driver.switchTo().frame(2);
//I print the size of frame(i.e. 3) and tried each and every frame value (i.e. 0,1,2)
Please correct wrt above code.
Thanks Diwakar