如何使用Selenium登录AliExpress

2024-04-18 09:30:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试自动登录到速卖通我找不到用户名和密码框。 我使用的是windows上的python3。 到目前为止,我已经试过了,这是一个开始:

driver = webdriver.Chrome(executable_path="C:/webdrivers/chromedriver")
driver.get('https://www.aliexpress.com')
driver.find_element_by_name("SearchText").send_keys("iphone 11")
driver.find_element_by_class_name("search-button").send_keys(Keys.ENTER)
driver.maximize_window()

继续尝试是:

^{2}$

或者

fields = driver.find_elements_by_class_name("login-password")

或者

fields = driver.find_elements_by_class_name("fm-field")

或者

driver.find_element_by_class_name("input-plain-wrap input-wrap-loginid ").send_keys("blahblah@gmail.com")
driver.find_element_by_id("fm-login-password").send_keys("blahblah")

对于前50个搜索AliExpress让我看到结果之前,我必须登录,但现在我必须和我所有的尝试失败,有什么想法我应该怎么做? (每次我保存“字段”时,它的长度是0而不是2)


Tags: namecomsendfieldsinputbydriverlogin
1条回答
网友
1楼 · 发布于 2024-04-18 09:30:21

尝试以下用户名和密码字段选择器:

用户名选择器:

driver.find_element_by_css_selector("div.input-plain-wrap.input-wrap-loginid").send_keys("blahblah@gmail.com")

或者

^{pr2}$

密码选择器:

driver.find_element_by_css_selector("div.input-plain-wrap.input-wrap-password").send_keys("password")

或者

driver.find_element_by_css_selector("input#fm-login-password").send_keys("password")

相关问题 更多 >