Reputation: 23
I have created two chrome instances and in the second chrome instance i am trying to enter card details which is present within iFrame. The below code is giving error.
var browser2 = browser.forkNewDriverInstance(true);
browser2.get('https://test.app.com');
browser2.switchTo().frame(element(by.id("card-number")).getWebElement());
Error:
Failed: stale element reference: element is not attached to the page document
Upvotes: 0
Views: 23
Reputation: 23
It worked after modifying the code as below,
browser2.switchTo().frame(browser2.$('#card-number').getWebElement());
Upvotes: 1