Reputation: 1157
I am trying to find input element which is of type file which is present in Pop up Iframe. But whenever I try to find that element it is giving me element not found error. Could somebody help me out in this regard?
Upvotes: 0
Views: 210
Reputation: 11
Switch to appropriate iframe and find your element in that frame.
Example ::
//By executing a java script
JavascriptExecutor exe = (JavascriptExecutor) driver;
Integer numberOfFrames = Integer.parseInt(exe.executeScript("return window.length").toString());
System.out.println("Number of iframes on the page are " + numberOfFrames);
//By finding all the web elements using iframe tag
List<WebElement> iframeElements = driver.findElements(By.tagName("iframe"));
System.out.println("The total number of iframes are " + iframeElements.size());
Upvotes: 1