Switch between browsers in a single test

64 views
Skip to first unread message

sathyan...@gmail.com

unread,
Mar 18, 2014, 6:11:25 AM3/18/14
to fluent...@googlegroups.com
Given I setup a meeting on different browsers as:
| Browser |
| chrome |
| firefox |
And I have logged in as admin user in "chrome" browser
And I login as participant user in "firefox browser"
When I add a chat message from admin page
Then I should see the chat message in the participant page

Please let me know how to switch between browsers and do certain action after switching. Maybe a code example would help.

Khanh

unread,
Mar 19, 2014, 7:08:53 AM3/19/14
to fluent...@googlegroups.com, sathyan...@gmail.com
Hi,

I used Cucumber JVM and Fluentlenium to obtain something like that:
Scenario Outline: scenario 2
Given I use browser <browser> with <parameters>
When ...
Then ...
Examples:
| browser | parameters |
| firefox | |
| chrome | webdriver.chrome.driver@/opt/chromedriver/chromedriver |

I used Cucumber JVM's scenario outline to replay the same scenario on differents browsers. I do not know if it is what you need but I think that if yours steps identify the target browser, it should work.

You can find some code example on my github :
https://github.com/jetoile/sample-cucumber

Hope this helps!

Cheers,

Khanh

sathyan...@gmail.com

unread,
Mar 19, 2014, 7:24:06 AM3/19/14
to fluent...@googlegroups.com, sathyan...@gmail.com
Hi Khanh,

Thanks.

I am aware of this example. According to your example, since you are using "Scenario Outline" it runs a 2 separate scenarios and it works for me too.

The problem i am trying to solve is switching between browsers in a single tests. Please let me know, if you have tried to solve this problem. Thanks a lot.

cheers,
Sathyan

Khanh

unread,
Mar 19, 2014, 7:46:46 AM3/19/14
to fluent...@googlegroups.com, sathyan...@gmail.com
Hi Sathyan,

Sorry, I did not try your usecase but I think it might work with something like that (in a simple scenario) :

And I have logged in as admin user in "chrome"
And I login as participant user in "firefox"
When I add a chat message from admin page in "chrome"
Then I should see the chat message in the participant page in "firefox"

with the annotation @SharedDriver(type = SharedDriver.SharedType.PER_SCENARIO)
and perhaps something like a context cache (associated with the driver) where each step could get its context (I think that you need to call initTest() to reinit things)...

I do not have time to test... sorry...


Hope this helps and good luck!

Cheers,

Khanh
Reply all
Reply to author
Forward
0 new messages