0

I'm trying to find the element under a iframe, and I've switch to the frame, but I still can not find the element enter image description here

my HTML is in the link: http://pastebin.com/AShYrdxQ

Curious
  • 282
  • 4
  • 21
Alex Bruce
  • 533
  • 2
  • 10
  • 23

2 Answers2

0

Hi first of all i found only one iframe on the page with id = msgframe and also please note that as per your source code that i frame is commented so not playing any role hence please do not use switch to driver simply use

List<WebElement> commonElements = driver.findElements(By.className("Apps_Title"));
       for(int i =0;i<commonElements.size();i++){
           System.out.println(commonElements.get(i).getText());
       }

and it will work thanks hope this will help you.

Rajnish Kumar
  • 2,828
  • 5
  • 25
  • 39
0

Try:

driver.switchTo().frame("needle-frame-id-or-name");

sometimes it's help me too:

driver.switchTo().defaultContent(); driver.switchTo().frame("needle-frame-id-or-name");

Kosmos
  • 333
  • 1
  • 5
  • 16
  • sometime iframe work with an other pages and need time to load them. Try any wait functions to be sure a page loaded. – Kosmos May 04 '16 at 20:36
  • WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(frameToBeAvailableAndSwitchToIt(By.id("frame")); – Kosmos May 04 '16 at 20:42