Search code examples
google-chromeselenium-webdrivernightwatch.js

Nightwatch switchWindow() not working in Google Chrome


I have a test that cause a new window to open that contains a form to fill out. In FireFox it works to switch to this window using browser.switchWindow(windowName), but in Chrome it does not seem to switch to the window as it is then unable to find the form to fill out in the new window.

Anyone run into anything like this and have a possible solution? Thanks!

Edit:

This is a small code snippet I found showing what I did.

browser
  .click('selector') // Button click to open new window
  .pause(1000)
  .switchWindow('newWindowID')

Solution

  • I got it to work, for me it was as simple as putting a short pause() before trying to switchWindow(). It seems it tried to switch to the new window before it actually opened.