TABLE OF CONTENTS
2. Executing Selenium Scripts in Command Prompt on Windows Operating System
1. Prerequisites
To configure Python and Selenium, refer to the article Configuring Web Applications Using Python Selenium Framework.
2. Executing Selenium Scripts in Command Prompt on Windows Operating System
Perform the following:
- Download and extract the script to your local folder. Navigate to the same folder.
- In the folder navigation bar, type 'cmd ' and press 'Enter' to view the Command Prompt screen.
- Run the following command to schedule and execute the script.The script execution command must resemble the following example:
behave -f allure_behave.formatter:AllureFormatter -o D:\projects1\Web_App\Application\mmt\Python_Selenium_Project133425488530054187\features\temp -f pretty D:\projects1\Web_App\Application\mmt\Python_Selenium_Project133425488530054187\features" --tags=@test001
The previous command is instructing Behave to run tests from the specified Feature File, generate Allure reports, and include only scenarios with the @test001 tag. The temporary Allure report files will be stored in the specified output directory.
The following table represents command-line arguments:Key Description behave This is the command to run Behave, which is a popular Python testing library for behavior-driven development (BDD).-f allure_behave.formatter:AllureFormatter -oThis part of the command specifies the formatter to be used for the output. In this case, it's the AllureFormatter, which is used to generate reports in the Allure format. Allure is a flexible and extensible test reporting framework. D:\projects1\Web_App\Android\mmt
\Python_Selenium_Project133425488530054187\features\tempThis flag specifies the output directory where the Allure report files will be generated. In this case, it's set to a temporary directory. -f pretty: This flag specifies that the output must also be in a human-readable format (pretty format). "D:\projects1\Web_App\Android\mmt
\Python_Selenium_Project133425488530054187\features"This is the path to the directory where your Behave Feature File is located. Behave will look for feature files in this directory. --tags=@test001 This flag filters the execution of scenarios based on the specified tags. In this case, it's set to run scenarios with the tag @test001. Tags in Behave are used to categorize and filter scenarios. - You can view the respective report.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article