Page 1 of 1

Switch between different browsers

Posted: Wed Jun 28, 2017 10:43 am
by Rakesh123
Hi Everyone,

I just wanted to how can we switch from one browser to another using Ranorex?

Thanks,
Rakesh

Re: Switch between different browsers

Posted: Wed Jun 28, 2017 11:15 am
by odklizec
Hi,

Cold you please share a bit more details about what exactly you want to achieve? What do you mean by "switch from one browser to another"? If you want to perform a test in multiple browsers, you should use Data Driven approach, as shown for example here:
https://www.ranorex.com/support/screencasts.html#c3896

And here (click Watch Now):
http://www.ranorex.com/automated-testin ... binar.html

Re: Switch between different browsers

Posted: Fri Jun 30, 2017 7:27 am
by Rakesh123
Hi,

Actually I have the below requirement...

1.Login to IE and do some functionality.
2.Login to chrome and do some functionality
Now same page will be displayed in both the browsers.
3.Now I need to go back to IE and do some functionality
4.Come back to Chrome and do some more functionality

Thanks,
Rakesh

Re: Switch between different browsers

Posted: Fri Jun 30, 2017 8:28 am
by odklizec
Hi,

In this case, all you need to use OpenBrowser action at various places in your test? Eventually, you may need to use Navigate action from "Invoke Action" menu.

Additionally, because you need two browsers running the same time, you may need to add BrowserName attribute to DOM element in repository and you will have to use two sets of xpaths (with two DOMs, one for each browser). Eventually, you can use just one set of xpaths, with one DOM, but then the BrowserName attribute needs to be variabilized and you need to set correct BrowserName variable before accessing specific browser (i.e. Crhome or IE).

You see, typically, we expect that the xpath generated in IE is usable (without change) in other browsers too. But because you will have two browsers running at the same time, you can't use the same xpaths, because Ranorex may find the same repo elements in both browsers. In this unfortunate case, it always use the first one found! So this is why you need to use two sets of xpaths or variabilized BrowseName. Hope this helps?