Forum Discussion

oleg_sigalov's avatar
oleg_sigalov
Occasional Contributor
11 years ago

All Browsers have the same "BrowserIndex" = 1


I'm trying to get in a dynamic way the browser object, because I'm running crossbrowsing.



I've implemented this:



bProc = "iexplore" or "chrome"  

BrowserIndex = Sys.Browser(bProc).BrowserIndex


Set browser = Browsers.Item(BrowserIndex)



I get always "browser" object as IE.

I've noticed in Object Browser" that all browsers have same "BrowserIndex" = 1

But I know that Chrome "BrowserIndex" = 3.



See attachments.

Thanks.

 

  • From the help for BrowserIndex:




    The BrowserIndex property specifies the browser index among other running browsers with the same name.



    For example, if you have two different Firefox versions installed and both of them are currently running, the first launched Firefox process has BrowserIndex of 1 and the other one has BrowserIndex of 2.



    Similarly, if 32-bit and 64-bit versions of Internet Explorer are running at the same time on 64-bit Windows, one browser instance has BrowserIndex of 1 and the other one has BrowserIndex of 2.





    You have three separate browsers (IE, FF, Chrome), and each will have a BrowserIndex of 1 since there is only one instance for each type.



    Are you looking for the Browsers.Item() property to get the specific browser?






































    Constant

    Value

    Description

    btIExplorer

    -1

    Microsoft Internet Explorer.

    btFirefox

    -2

    Mozilla Firefox.

    btChrome

    -3

    Google Chrome.

    btOpera

    -4

    Opera by Opera Software.

    btSafari

    -5

    Apple Safari.


     


  • marin's avatar
    marin
    Frequent Contributor
    Hello Oleg,



    we are also doing the cross-browser testing and the approach we use is the follwing:

    we defined a set of Keyword Tests for the project - each keyword test opens a different browser.

    Then we defined the project test items to reflect this - each test run will be opening a different browser (as keyword test) and then executing all defined tests in it.

    Then browser is closed (per script as the last test case) and next browser is opened via keyword test and all defined tests executed anew in that browser.



    Hope this helps,



    Marin

  • jeff_meakins's avatar
    jeff_meakins
    Occasional Contributor
    From the help for BrowserIndex:




    The BrowserIndex property specifies the browser index among other running browsers with the same name.



    For example, if you have two different Firefox versions installed and both of them are currently running, the first launched Firefox process has BrowserIndex of 1 and the other one has BrowserIndex of 2.



    Similarly, if 32-bit and 64-bit versions of Internet Explorer are running at the same time on 64-bit Windows, one browser instance has BrowserIndex of 1 and the other one has BrowserIndex of 2.





    You have three separate browsers (IE, FF, Chrome), and each will have a BrowserIndex of 1 since there is only one instance for each type.



    Are you looking for the Browsers.Item() property to get the specific browser?






































    Constant

    Value

    Description

    btIExplorer

    -1

    Microsoft Internet Explorer.

    btFirefox

    -2

    Mozilla Firefox.

    btChrome

    -3

    Google Chrome.

    btOpera

    -4

    Opera by Opera Software.

    btSafari

    -5

    Apple Safari.