1
votes

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?

2
It seems that if I downgrade to chrome v57 this works, but it is not working in chrome v58. Did the changes in chrome 58 affect the way selenium handles iframes at all? I'm using chromedriver v2.29 for reference - insldmc
Thought I should also add it only seems to be my iframe that I can't switch into, I'm able to do so for other iframes without issue, but on Chrome 58+ it doesn't work for just this iframe - insldmc

2 Answers

0
votes

This looks like a chromium bug in case others run into this issue:

https://bugs.chromium.org/p/chromedriver/issues/detail?id=1777

0
votes

Have you tried adding a .pause(1000) before switching to the frame?