Posts

WebDriver Basic Commands, Navigational Commands & Conditional Commands

Webdriver Basic Commands print(driver.title) #Page Title print(driver.current_url) #Current URL driver.close() #close only current tab driver.quit() #close the Browser Script: from selenium import webdriver import time driver=webdriver.Chrome(executable_path="D:\Selenium\Browsers\chromedriver_win32\chromedriver.exe") driver.get("http://demo.automationtesting.in/Windows.html") time.sleep(5) print(driver.title) #page title print(driver.current_url) #page url driver.find_element_by_class_name("btn-info").click() time.sleep(5) driver.close() #current focussed tab driver.quit() #closes browser Navigation Commands driver.back() driver.forward() Script: from selenium import webdriver import time driver=webdriver.Chrome(executable_path="D:\Selenium\Browsers\chromedriver_win32\chromedriver.exe") driver.get("http://demo.automationtesting.in/Windows.html") time.sleep(5) print(driver.title) driver.ge

How to Run Tests On Browsers

How to Run Tests On Chrome, FireFox & IE Browsers Download the Chrome Driver - https://chromedriver.storage.googleapis.com/index.html?path=87.0.4280.88/ Download the Firefox Driver - https://github.com/mozilla/geckodriver/releases Download the IE Driver - https://www.selenium.dev/downloads/ Packages To Import in PyCharm from selenium import webdriver from selenium.webdriver.common.keys import Keys Import time Script: from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver=webdriver.Chrome(executable_path="D:\Selenium\Browsers\chromedriver_win32\chromedriver.exe") time.sleep(5) driver.get("https://www.google.com/") time.sleep(5) print(driver.title) print(driver.current_url) print(driver.page_source) print(driver.session_id) print(driver.name) driver.quit()

How to Download & Install Selenium & Python

How to Download & Install Python? 1. Go to "www.python.org" 2. Go to Downloads & Download the latest version of python. 3. Double click on the python downloaded file and install it. How to Check Python Installed on Your PC or Not? Go to the command window and type “py” and click on enter. It shows python version number and date of installation. How to Download & Install PyCharm? Go to https://www.jetbrains.com/pycharm/download"and download the community file and install it. How to Create a Project in PyCharm? 1. Open the PyCharm and Click on File 2. Click on New Project and Enter a Project Name How to Create a Package under Project in PyCharm? Click on Project-----Select New ---- Click on Python Package and Enter package name. How to create a Python File? Click on package---Select New---Click on Python file and Enter file name. Note: We can create multiple packages under a package. The Package and File Names should be Added Without Spa