0

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.

2
  • I tried $x('//*[@class="pos-form-element pos-text-input email-alias-input__alias-input ng-pristine ng-invalid ng-touched"]') on chrome devtool. it return an empty array. Commented Sep 26, 2022 at 9:09
  • @KpqEQpDR Are you still here? The answer is quite simple. Commented Sep 28, 2022 at 13:26

1 Answer 1

1

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"]'))).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.