Home > other >  Selenium Applitools swtich Tab/Window for checkpoint
Selenium Applitools swtich Tab/Window for checkpoint

Time:03-11

How do I switch the browser tab/window to compare the views in Applitools? Problem is I've got eyes.check on a login window and after loggin in there is a new window opened but the checkpoint compares the old tab/window. Target.window() does not take any parameters. How do I do that?

Thanks

CodePudding user response:

You'll need to switch the driver context to the new tab using Selenium before taking the screenshot with Applitools.

You can see methods on tab switching in Java Selenium from this answer: link

At a high level, what you should do is:

  1. Open the new tab
  2. Use Selenium to switch the driver context to the new tab
  3. Call eyes.check()

Additionally, be sure to set the driver object equal to the return value of your call to eyes.open(). Doing this will ensure the Applitools Eyes object can keep track of the context the driver is in.

myDriver = eyes.open(driver, appName, testName, viewportSize);
// switch browser context using myDriver variable
// take screenshot etc.
  • Related