James Craig
James Craig

Reputation: 493

Selenium IDE 2.9.1 - Can I run tests from a command line?

I would like to add a command line start for Selenium IDE test scripts to our build process so some of the tests are run immediately after the latest code is built for our products.

I have been looking and everything I find seems to relate to older versions. I can't find anything that looks up to date.

Can I run tests that I have recorded in Selenium IDE 2.9.1 from the command line - and by extension, a batch file to run multiple tests.

Is there documentation that I did not find? Can someone direct me to it?

Thanks.

Upvotes: 1

Views: 1376

Answers (1)

Alex
Alex

Reputation: 91

You didnt specify an operating system but i think you mean windows, and yes, you can run selenium IDE test suites from powershell or CMD on windows.

You will need Java installed on your machine, and also the Selenium Server.jar file which should have come with your installation of Selenium, if not you can download from the Selenium Site. Then, create a test suite in IDE and save it somewhere on your machine. (you can only run test suites, not testcases - i wont explain the difference between the two here)

Then in powershell or CMD you run this command, you will need to change it depending on your installation directories.

C:\Java\JDK1.8.0_66-X64\bin\java -jar C:\Selenium\Selenium-Server\selenium-server.jar -htmlSuite *firefox "baseurl" "C:\temp\testsuitename" "C:\TEMP\logs" -timeout 0060 -trustAllSSLCertificates

I will break this down for you -

C:\JDK1.8.0_66-X64\bin\java -jar - this is your Java installation directory (mine is Java JDK 1.8)

C:\Selenium\Selenium-Server\selenium-server.jar - This is the location of your Selenium .jar file.

-htmlSuite *firefox These are .jar file options to tell the jar file you are running it from a command line and to use firefox

"baseurl" In here, you should enter your base url which would normally be at the top of the IDE gui. eg, www.google.com

"C:\temp\testsuitename" The full path where you have saved your test suite

"C:\TEMP\logs" Running from command line produces a html log, advise where you want this placed

-timeout 0060 -trustAllSSLCertificates There are additional options, of which there are many. In this case the total time the command will run before it times out is 60 seconds, and it will ignore all those untrusted certificate errors that firefox often gets (where you need to keep adding exceptions etc).

Hope i could help!

Upvotes: -1

Related Questions