SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Steps Of Running Selenium IDE Test Suite From Command Prompt Using Batch File

Before running selenium script suite from command prompt, you must be aware about How to create and run test in selenium IDE. You can read more articles about selenium IDE different commands with examples from my past posts.

Selenium has its own TestRunner and we need to use it for running selenium IDE software test case from command line. Let me describe all process step by step.



Step 1: Open selenium IDE software testing tool from your Firefox toolbar. (Click here to see how to download and install selenium IDE).

Step 2: Download latest selenium server standalone jar file from (http://docs.seleniumhq.org/download/) and save it at folder path "D:\SeleniumTest". We are using "selenium-server-standalone-2.33.0.jar" in this example. You can use latest version but do not forget to update the same in batch file.

Step 2: Create bellow given software test case in your selenium IDE.

New Test
CommandTargetValue
openhttps://www.google.com
typeid=gbqfqList of Selenium Commands With Examples part - 1
clickid=gbqfb
pause5000
captureEntirePageScreenshotD:\\SeleniumTest\\Seleniumtest.png

Step 3: Save above software test case at folder path "D:\SeleniumTest" with name "SeleniumTestcase.html".

Step 4: Save above software test Suite at folder path "D:\SeleniumTest" with name "SeleniumSuite.html".

Step 5: Create batch(.bat) file with exactly same as bellow given command line syntax and save it at folder path "D:\SeleniumTest" with name "Seleniumtext.bat".
-----------------------------------------------------
java -jar D:\SeleniumTest\selenium-server-standalone-2.33.0.jar -htmlSuite "*firefox" "http://www.google.com" "D:\SeleniumTest\SeleniumSuite.HTML" "D:\SeleniumTest\seleniumtestresult.html"

D:\SeleniumTest\seleniumtestresult.html
------------------------------------------------------
(Note1 : Here, we are using version 2.33.0 of selenium server standalone jar file for our example. If you are using any other version (example : selenium-server-standalone-2.34.0.jar) then you have to update above command line syntax accordingly(Example : D:\SeleniumTest\selenium-server-standalone-2.34.0.jar). Use files and folders names exactly as described above otherwise your script will not run. ).


(Note2 : Use selenium server standalone jar file version according to your browser version. For latest version of browser, you need to use latest selenium server standalone jar file in your test.)



(Note3 : You can replace "*googlechrome" at place of "*firefox" to run your test suite in Google chrome. You can replace "*iexplore" at place of "*firefox" to run your test suite in Internet explorer.)


Now your folder "SeleniumTest" located in "D:" drive should have files as per bellow given screen shot.


Now you are ready to run your software test suite using batch file(You can run above given syntax from command prompt (manually) too to run your test.).

Double click on "Seleniumtext.bat" file.


It will open command prompt as above screenshot > Start selenium server > Load Selenium Test Runner > Load your browser > Execute test suite(SeleniumSuite.HTML) > save test report(seleniumtestresult.html) at specified location(D:\SeleniumTest) and finally it will open test report file (seleniumtestresult.html) automatically.

13 comments:

  1. Why cant I use it with tests that includes rollups commands ?

    ReplyDelete
  2. Why cant I use it with tests that includes Rollup commands ?

    ReplyDelete
  3. Not able to run in Chrome Browser.
    Is it browser version problem or typo problem.
    I use Google Chrome Version 32.0.1700.102 m.

    ReplyDelete
  4. hi,
    Does it support java-script ? As I am trying to log-in the page with different users using the concept of parametrization which was mentioned in this blog. Getting an error message like Undefined storeVars, while.Could you please advise what can be done here.

    ReplyDelete
  5. Please explain what you mean by, "Step 2: Create bellow given test case in your selenium IDE." Then, in the table below that statement, how would that information go into a test case?(!)

    ReplyDelete
    Replies
    1. You need to copy paste all the commands, targets and values In selenium IDE as shown in table.

      Delete
  6. I am getting below error, any suggestion:
    15:43:06.393 INFO - Launching a standalone Selenium Server
    15:43:06.473 INFO - Java: Oracle Corporation 21.0-b17
    15:43:06.477 INFO - OS: Windows 7 6.1 amd64
    15:43:06.491 INFO - v2.46.0, with Core v2.46.0. Built from revision 87c69e2
    15:43:06.541 INFO - Driver class not found: com.opera.core.systems.OperaDriver
    15:43:06.546 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered

    ReplyDelete
  7. I'm afraid this isn't Selenium IDE you're referring to here, this is Selenium Server / RC, a great tool nonetheless.

    There are ways to open a Selenium IDE window automatically, but no way for it to be ran automatically.

    ReplyDelete
  8. Hi ..

    I not able to run the test suite neither in IE nor Chrome even already follow the note 3 as below

    (Note3 : You can replace "*googlechrome" at place of "*firefox" to run your test suite in Google chrome. You can replace "*iexplore" at place of "*firefox" to run your test suite in Internet explorer.)

    ReplyDelete
  9. https url is not working can please advise

    ReplyDelete
  10. How can i use .xml file data while running with command prompt?

    ReplyDelete
  11. How can i use .xml file data while running with command prompt?

    ReplyDelete
    Replies
    1. check this
      http://stackoverflow.com/questions/19250176/how-can-i-read-variables-from-data-pool-with-selenium-ide

      Delete