switch between tabs in chrome using arquillian graphene

104 Views Asked by At

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.

0

There are 0 best solutions below