Reputation: 361
Can phantomjs perform actions like getText() or enterText() inside iFrame? I am using protractor to do my testing. Phantomjs can perform actions in the default frame but inside iframe the locators get timed out. Any suggestions?
Upvotes: 2
Views: 1074
Reputation: 7288
Yes.. First, double-check the name of the id of the iframes using console.log(page.childFramesName());
.. Next, you can switch the page to the iframe using page.switchToChildFrame('name_here');
. Finally, you can do whatever you want.
Upvotes: 0
Reputation: 3731
You need to switch to the iframe before you can use it. Like so...
browser.switchTo().frame(iframeNameOrIndex);
Then to switch back, you use:
browser.driver.switchTo().defaultContent();
The Protractor API is a good source for this...
Also, if the iframe is from another domain you may need to add the --web-security=no
option for phantomjs:
phantomjs --web-security=no spec.js
Upvotes: 5