unable to select iframe element using locators
I have been trying to click an anchor element from inside an iframe on one of my views and so far I have been unable to achieve this.
I have so far tried the locators below ptor.findElement(protractor.By.css()).click(), ptor.findElement(protractor.By.xpath()).click(), ptor.findElement(protractor.By.id()).click() and ptor.findElement(protractor.By.name()).click()
along with all of the above locators I have tried the same using webdriver and as yet am still unable to grab the element.
Is there a way of achieving this is it a limitation?
Hi! To do something in another frame or window, you're going to have to tell Webdriver to switch contexts. You can do this with
ptor.switchTo().frame('<framename>')
See this for more documentation: https://code.google.com/p/selenium/source/browse/javascript/webdriver/webdriver.js#1375
Works like a charm. Thank you
Keep up the great work.
Hy, I have problem with accessing elements in iframe, although i switched successfully to iframe by this lines:
var driver = ptor.driver; ptor.switchTo().frame(driver.findElement(protractor.By.tagName('iframe')));
But those elements are still invisible when i try to access them by Id, tagName, xpath.
Do you know maybe some solution?
Regards
@juliemr thanks! this one helped a lot
Encountering the same problem with @lovacuzitu. Any update?
Got same issue, unable to find iframe to check its size with getSize()