I'm trying to write e2e tests using Nightwatch for a chrome extension. The extension inserts an iframe onto certain pages. I'm able to start up chrome with the extension but run into an error when I try to switch into the frame
Here is my test:
module.exports = {
'My test' : function (browser) {
browser
.url('https://myurl.com')
.waitForElementVisible('iframe[id=my_frame]', 5000)
.frame('my_frame')
.end();
}
};
Here is the error message:
INFO Response 200 POST /session/b747140552587912484ec27e0d91cd27/frame (6ms) { sessionId: 'b747140552587912484ec27e0d91cd27', status: 8,
value: { message: 'no such frame: element is not a frame
(Session info: chrome=58.0.3029.96)\n (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64)' } } LOG → Completed command frame (10 ms)
I know the frame is there, because I can pause the test and inspect the page. Also nightwatch successfully finds the frame element in the waitForElementVisible command.
Here's the html
<iframe id="my_frame" src="chrome-extension://honkfenocfnhdbpakgenabnlnpgccadm/html/iframe/test.html" scrolling="false" style="width: 440px; transform: translateX(0px);"></iframe>
What am I doing wrong?