Create Python project in Sublime Text

Type Sublime in Windows search box to open Sublime Text.

Open New Window by going on File -> New Window.

On this new window, add a new folder to the project by going on the menu Project -> Add Folder to Project.

The selected folder will be displayed in the project. Multiple folders can be added to the project.

Select Build System for the project is Python.
Create a Python source code file

Right the folder and click New File to create a Python source code file.

Go to File -> Save to save this file in the folder.

Type “login-form-successful.py” in File name textbox and click on Save button.
Run a simple Selenium Python script

Create open-istqblearning-website.py file and input the script below.
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")

Make sure Python is checked in Build System.

Select the scritp file, Tools -> Build to run it. The message “Finish running the script” will be printed in the Sublime Text console.
« Previous Next »