1

I need to switch tabs using Graphene and continue the test without failing.

I am testing an application that creates a project and then opens that project from a link on a page.

My issue is that it opens the project in a new tab and to continue the test I have to switch to the new tab.

I am using the selenium switch windowHandler but getting an error from the Graphene. I will not know the new URL until the project has been created.

//Switch to tab opened from previous test
    public void switchTab(int tabNumber) throws Exception{
        for (String winHandle : driver.getWindowHandles()) {
            driver.switchTo().window(winHandle);
            Thread.sleep(3000);
        }
    }

Error: The page object 'CreateChangeSubProjStruct' that you are navigating to using either Graphene.goTo() or @InitialPage is not annotated with @Location

I can see the new page opens and is on top but the test is running on the original tab.

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
Sharon
  • 146
  • 1
  • 8
  • The exception is probably happening somewhere else, not in the posted code. As the error message says, you probably have a `Graphene.goTo` call with an invalid argument. – Vsevolod Golovanov Nov 20 '17 at 16:30

0 Answers0