Test script -Open google and select a suggestion
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome(executable_path="C:/Users/Prashant/PycharmProjects/Automation.py/Drivers/chromedriver.exe")
driver.implicitly_wait(5)
driver.get("https://www.google.com/")
print((driver.title))
driver.find_element(By.NAME,"q").send_keys("Naveen Automation Labs")
options_list=driver.find_elements(By.CSS_SELECTOR,'ul.erkvQe li span')
print(len(options_list))
for ele in options_list:
if ele.text=='naveen automation labs telegram':
ele.click()
break
time.sleep(5)
driver.close()
Comments
Post a Comment