Richard
Richard

Reputation: 15

Can you have cross browser testing using Robot Framework

I have a robot-framework test suite that runs all OK.

I have it running with pabot and selenium Grid, so parallel testing is all good.

My question is, can I run my test suite against multiple browsers without having to manually run the same scripts for each browser or duplicating my test suite for each browser. Essentially, using a "Resource.txt" file to tell the test to instantiate the browser the grid node is set up for.

For example, in a TestNG project (Using POM method) I use the "if" and "else" methods to tell the test to use the browser that the selenium grid node is set up for.

Python 2.7 RF 3.0.2 Grid 3.5

Upvotes: 0

Views: 1398

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385910

The common way to do this is to use a variable to hold the name of the browser, and then set the variable from the command line

In your test case:

open browser  ${ROOT_URL}  ${BROWSER}

From the command line:

robot --variable BROWSER:firefox ...
-or-
robot --variable BROWSER:chrome ...

An alternative to setting the variable on the command line is to have your tests use a variable file which dynamically sets the value of the variable based on runtime conditions.

Upvotes: 1

Related Questions