
How to install Python on Windows
Step by Step for Beginners
Today we will learn:
Check if Python is already installed
Download Python
Install Python
Validate if Python is installed properly
How to uninstall python
Step 1 : Check if python is already installed
python --version
Step 2 : Download Python - https://www.python.org/downloads/windows/
Step 3 : Install Python
Step 4 : Add Python to Path environment variable (if not already added)
Step 5 : Check if Python and Pip are installed
python --version
pip --version
How to Uninstall or Repair Python
References:
https://pip.pypa.io/en/stable/installing/
by : Raghav Pal
How to install Python on MacOS
Step by Step for Beginners
Today we will learn:
Check if Python is already installed
Download Python
Install Python
Validate if Python is installed properly
How to uninstall python
Step 1 : Check if python is already available
Step 2 : Download and install python
https://www.python.org/downloads/
Step 3 : Check if python is installed properly
python --version
pip --version
In case pip is not installed
sudo easy_install pip
How to uninstall Python
Follow steps in video
by : Raghav Pal
How to install Selenium for Python
Step by Step for Beginners
Today we will learn:
How to install Selenium
How to uninstall Selenium
by : Raghav Pal
IDE for Python : PyCharm
Step by Step for Beginners
What is IDE
Integrated Development Environment
Why we need IDE
Structure
Auto-completion
Debugging
Management
IDE for Python : PyDev
How to install PyDev in Eclipse
Step by Step for Beginners
Step 1 : Eclipse > Help > Eclipse Marketplace
Search for PyDev
Install Pydev and restart Eclipse
Step 2 : Eclipse > Help > Install New Software
Pydev - http://www.pydev.org/updates
Restart Eclipse
Step 3 : Goto File > New > Others > Pydev Project
Configure python interpreter
Step 4 : Add python module and write python code
First Selenium Python test
Today we will :
Create a new project in PyCharm
Add Selenium scripts
Add Browser driver
Run and Validate
pip install -U selenium
CODE
import time
from selenium import webdriver
driver = webdriver.Chrome("../drivers/chromedriver.exe")
driver.set_page_load_timeout(10)
driver.get("https://google.com")
driver.find_element_by_name("q").send_keys("Automation step by step")
driver.find_element_by_name("btnK").click()
time.sleep(2)
driver.close()
driver.quit()
print("Test Completed")
Selenium Python testing on Chrome
Step by Step
Today we will :
How to run test on Chrome
How to run test on Headless Chrome
How to set Chrome Options
For headless chrome
Chrome browser v59+
ChromeDriver v.2.38+
CODE
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# chrome_options = webdriver.ChromeOptions()
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-extensions")
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path="../drivers/chromedriver.exe")
driver.get("https://google.com")
print(driver.title)
driver.find_element_by_name("q").send_keys("Automation step by step")
driver.find_element_by_name("btnK").click()
print(driver.title)
driver.close()
driver.quit()
print("Completed")
REFERENCES
http://www.assertselenium.com/java/list-of-chrome-driver-command-line-arguments/
Selenium Python testing on Firefox
Today we will :
How to run test on Firefox
How to run test on Headless Firefox
How to set Firefox Options
CODE
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
firefox_options = webdriver.FirefoxOptions()
firefox_options.add_argument("--headless")
path = "../drivers/geckodriver.exe"
driver = webdriver.Firefox(executable_path=path, firefox_options=firefox_options)
driver.get("https://google.com")
driver.find_element_by_name("q").send_keys("Automation step by step")
time.sleep(2)
driver.find_element_by_name("btnK").send_keys(Keys.ENTER)
time.sleep(2)
print(driver.title)
driver.close()
driver.quit()
https://seleniumhq.github.io/selenium/docs/api/dotnet/html/T_OpenQA_Selenium_Firefox_FirefoxOptions.htm
https://stackoverflow.com/questions/42529853/list-of-firefox-and-chrome-arguments-preferences
Selenium Python testing on IE
Step by Step
Today we will learn :
How to run test on Internet Explorer
How to set Desired Capabilities
CODE
from selenium import webdriver
caps = webdriver.DesiredCapabilities.INTERNETEXPLORER
caps['ignoreProtectedModeSettings'] = True
path = "../drivers/IEDriverServer.exe"
driver = webdriver.Ie(executable_path=path, desired_capabilities=caps)
driver.get("https://google.com")
driver.find_element_by_name("q").send_keys("Abcd")
driver.find_element_by_name("btnK").click()
driver.quit()
print("Completed")
REFERENCES
http://selenium-release.storage.googleapis.com/index.html
https://www.seleniumhq.org/download/
https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
Selenium Python | How to find web elements
Today we will learn :
How to find web elements on web page
---------------------------------------------
Functions in Selenium to find Web Elements
---------------------------------------------
Some Plugins
---------------------------------------------
Useful Tips
---------------------------------------------
Functions to find web element
find_element_by_id
find_element_by_name
find_element_by_class_name
find_element_by_css_selector
find_element_by_tag_name
find_element_by_link_text
find_element_by_partial_link_text
find_element_by_xpath
Functions to find web elements (list of elements)
find_elements_by_id
find_elements_by_name
find_elements_by_class_name
find_elements_by_css_selector
find_elements_by_tag_name
find_elements_by_link_text
find_elements_by_partial_link_text
find_elements_by_xpath
References:
https://www.w3schools.com/xml/xpath_syntax.asp
https://www.w3schools.com/html/html_id.asp
This course is created for complete beginners.
Get started with Selenium in Python step by step.
If you are a complete beginner on Selenium or Python, this course is for you. Very basic step by step videos to guide you from scratch.
In this course we will learn:
How to install Python (Mac & Windows)
How to install Selenium
How to setup Selenium Python project
How to create first test script
How to generate reports
How to create Automation Framework
How to run from command line
How to use Jenkins for Continuous Integration
How to record & play
How to use testing frameworks like PyUnit and PyTest
How to use Allure Reports
Create an end-to-end Automation Framework from scratch
And much more...
Do not worry if you have never used Python or Selenium. I will guide you on every step.
Let's Get Started...