from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
import selenium.webdriver.support.ui as ui
from selenium.webdriver.support.ui import WebDriverWait
import selenium.webdriver.support.expected_conditions as EC
import os
import time
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')
dir_path = os.path.dirname(os.path.realpath(__file__))
#Update Selenium chrome driver folder path here
chromedriver = dir_path + "/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chrome_options=options, executable_path= chromedriver)
time.sleep(1)
driver.get("http://www.hungama.com/")
driver.maximize_window()
element = WebDriverWait(driver, 1000).until(EC.presence_of_element_located((By.XPATH, "//*[contains(text(),'Mobile and Tablet')]")))
element.click()
print(element.text)
driver.close
Comments
Post a Comment