Course Content
Testing Tools
Testing Tools
0/1
Sample Python Programs
Sample Python Programs
0/1
Selenium Python First Script
Selenium Python First Script
0/2
HTML Form elements
HTML Form elements
0/1
Handle HTML Frames
Handle HTML Frames
0/2
Handling Dropdown Lists
Handling Dropdown Lists
0/2
Selenium Action class
Selenium Action class
0/1
Python Database Programming
Python Database Programming
0/1
Selenium Python for Beginners [ 2024 ]
About Lesson

Run Python Script

Using the Python Interactive prompt, you can run only one command or Python statement one at a time. Python Script allows you to run multiple statements to accomplish a particular task.

The Python script can be written using an editor like Notepad or Notepad++:

  • Save the Python script.
  • The Python script files have .py file extension.

> python script.py

This command invokes the Python interpreter in script mode. It begins executing the script and continues until the script is finished.

Example

To run a Python test in the script file GoogleHomePageTest.py

You can use the following command. Note that you need to change the directory to the script directory path. Assume the script file is in the directory PythonProject under the C:

You can use the change directory command at the prompt to switch the working directory:

> cd C:PythonProject

> python GoogleHomePageTest.py

 

Run Python Script Command line