Forum Discussion

jkrolczy's avatar
jkrolczy
Regular Contributor
6 years ago

Chrome: Switching between multiple Tabs

The Web application I am testing at a point when selecting multi links will open a tab per link.

 

When opening 1 link, I am already focused to that Tab and when I do the Close button on that page I am directed back to the original Dashboard page of the web app.

 

When I have more then 1 Tab, how can I switch between the 2 or more Tabs created from these links.

 

I'm using JScript.

 

I have written some code to reflect that the 2 Page object are there and dumping out VisibleOnScreen

that displays the correct values.

 

But going through posts/solutions in the forum, I have not seen a solution to help me focus on 1 Tab to the other.

 

function fndrectab()

{

   rec1Obj = Sys.Browser("chrome").Page("http://something.com/rec/#/details/111/editor/inst?mode=edit");

   rec2Obj = Sys.Browser("chrome").Page("http://something.com/rec/#/details/222/editor/inst?mode=edit");

 

if(rec1Obj.Exists)

{

  Log.Message("Rec 1 found");

  Log.Message(rec1Obj.VisibleOnScreen);

} 

Delay(1000);

 

// rec2Obj.Click(); works to focus on Tab I want to see, but gives a warning

// 'The action may be performed incorrectly, because the control is not visible.

 

if(rec2Obj.Exists)

{

  Log.Message("Rec 2 found");

  Log.Message(rec2Obj.VisibleOnScreen);

}

 

}

 

Would like to know how to going from rec1Obj Tab to rec2Obj Tab.

 

Thanks,

 

  •  

    I think I will try the following:

    create a loop

    Sys.Browser("chrome").Page("http://something.com/*").Keys("^[Tab]");

    Check when the Tab(page) I want is VisibleOnScreen

    break out of Loop

    And I should be on the Tab I want to work with

     

     

  • jkrolczy's avatar
    jkrolczy
    Regular Contributor

     

    I think I will try the following:

    create a loop

    Sys.Browser("chrome").Page("http://something.com/*").Keys("^[Tab]");

    Check when the Tab(page) I want is VisibleOnScreen

    break out of Loop

    And I should be on the Tab I want to work with