简体   繁体   中英

Logging into Ebay using Python Sel

I'm trying to log into ebay using Python Selenium Chromedriver but having some difficulty.

driver.get("https://signin.ebay.co.uk/ws/eBayISAPI.dll")
driver.maximize_window()

email_address = driver.find_element_by_xpath("//input[@placeholder='Email or username']")
password = driver.find_element_by_xpath("//input[@placeholder='Password']")

email_address.send_keys("email")
password.send_keys("password")

The error is that the element is not visible:

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible

It should be fairly straight forward but I can't figure it out. On similiar issues I've had before it was something to do with iframes.

Many thanks

There are two elements matching with the given XPATH.

Try the following code:

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome();

driver.get("https://signin.ebay.co.uk/ws/eBayISAPI.dll")
driver.maximize_window()

email_address = driver.find_element_by_xpath("//span/input[@placeholder='Email or username']")
password = driver.find_element_by_xpath("//span/input[@placeholder='Password']")

email_address.send_keys("email")
password.send_keys("password")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM