Create Python project in PyCharm Community

Open PyCharm by typing “pycharm” in search box of Windows and then click on the PyCharm Community Edition.

Click on New Project.

Select project type, name, store location, selenium python enviroment as described above and then click on Create button.

The LoginForm project is created successfully.
Create a Python source code file

Right click on LoginForm project and click New -> Python Package

Type Python package name is “Demo” and then press Enter.

Right click on Demo package and select New -> Python File.

Input name is “login-form-successfully.py and press Enter.
Run a simple Selenium Python script

Create open-istqblearning-website.py file and input the script below and then run it.
import time
from selenium import webdriver
# Creates a new instance of the chrome driver.
driver = webdriver.Chrome()
# Loads a web page in the current browser session
driver.get("https://istqblearning.com")
# Waits for 5 seconds and then close the browser
time.sleep(5)
driver.close()
print("Finish running the script")

After the script finished running successfully, the message “Finish running the script” will be printed in the Pycharm console.
« Previous Next »