0

Click method don't open the new page. My code trials as as follows:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time    
drive.webdriver.Chrome(executable_path=r"C:\Users\mvintee\project_for_selenium\chromedriver_win32\chromedriver.exe")
driver.get("https://www.verio.com/")
print(driver.title)
driver.find_element(By.ID,"stylesheet1").click()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

(By.ID,"stylesheet1") element represents the <body> element and ideally there is no point in clicking on the <body> element. Rather your usecase would be to click on Login


To click on the element Login you can use either of the following locator strategy:

  • Code block:

    driver.execute("get", {'url': 'https://www.verio.com/'})
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button#onetrust-accept-btn-handler"))).click()
    driver.find_element(By.CSS_SELECTOR, "div.login-form > a[href*='/secure/login.html']").click()
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
  • Browser Snapshot:

verio

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352