Problem with Chrome tabs

5 posts, 0 answers
  1. Juan
    Juan avatar
    18 posts
    Member since:
    Mar 2012

    Posted 22 May 2012 Link to this post

    Hi everyone!

    I'm having a problem with Chrome, the web site that I;m automating is opening an unexpected page in a second tab in Chrome. I've read that is possible to disable the tabs in other browsers, but in chrome is impossible disabling the tabs.

    The problem is that I don't know hot to return to my first tab (the SetFocus method doesn't work for this)
    Could someone know how to manage the tabs in Chrome?

    See the attached image with an example

    Please advice,
    Thanks!
  2. Juan
    Juan avatar
    18 posts
    Member since:
    Mar 2012

    Posted 23 May 2012 Link to this post

    Any ideas?
    Does my question make sense?

    Please advice!!!
  3. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 23 May 2012 Link to this post

    Hello Juan,

    I recommend using key presses to accomplish this. If the second tab doesn't have focus, first ensure it's active:

    Manager.Desktop.KeyBoard.KeyDown(System.Windows.Forms.Keys.Control);
    Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab);
    Manager.Desktop.KeyBoard.KeyUp(System.Windows.Forms.Keys.Control);

    Then you can close it:

    Manager.Desktop.KeyBoard.KeyDown(System.Windows.Forms.Keys.Control);
    Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.W);
    Manager.Desktop.KeyBoard.KeyUp(System.Windows.Forms.Keys.Control);

    Focus should return to the first tab where you can continue your automation.

    Kind regards,
    Anthony
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  4. Juan
    Juan avatar
    18 posts
    Member since:
    Mar 2012

    Posted 24 May 2012 Link to this post

    Thank you Anthony!

    I'm going to use the code that you suggested me, but to return to my first tab using Ctrl+1.

    I just want to report to you guys, that something is happening with the Chrome Extension, because only when I run my test in Chrome, I get the Internet Explorer and Safari web pages. Do you have reports about something like that?

    Thanks,
    Juan
  5. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 24 May 2012 Link to this post

    Hello Juan,

    I'm not sure what you mean. Can you provide more information?
    • Does your website render differently based on what browser is used?
    • If so, are you saying that when executing in Chrome it presents the IE/Safari version of your site?
    • If so, does this occur manually in Chrome when not executing with Test Studio?

    Kind regards,
    Anthony
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top