KpqEQpDR
KpqEQpDR

Reputation: 1

Python Selenium Chrome Unable to Find Element?

I'm new to Selenium, and I'm having trouble figuring out how to automate finding elements such as buttons and text fields. Here's what I have:

import os
from selenium import webdriver

os.environ["PATH"] = "chromedriver_win32"
driver = webdriver.Chrome()
driver.get("https://signup.mail.com#.7518-header-signup1-1")
driver.find_element(
    "xpath",
    '//*[@class="pos-form-element pos-text-input email-alias-input__alias-input ng-pristine ng-invalid ng-touched"]',
)

I'm confused because it's saying it cannot find the element. Is there anything obvious that I'm doing wrong? I'm not sure how to fix this.

Upvotes: 0

Views: 58

Answers (1)

Duc Nguyen
Duc Nguyen

Reputation: 321

You can find your element using something like element = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, '//*[@class="pos-form-element pos-text-input email-alias-input__alias-input ng-untouched ng-pristine ng-invalid"]'))).

Upvotes: 1

Related Questions