簡體   English   中英

登錄 Flipkart

[英]Logging into Flipkart

我正在使用 Python 和 selenium,並嘗試登錄到下面的 Flipkart 網頁是我的代碼以及 html 標簽。 我也不斷收到“元素點擊被攔截”,我的 xpath 為用戶名列返回 null

xpath used for UN: ("//html[body[div[2][div[div[div[div[div[2][div[form[div[2][input[@type ='text']]]]]]]]]]]]")

from selenium import webdriver
chromedriver = 'E:\chromedriver\chrome\chromedriver.exe'
driver = webdriver.Chrome(chromedriver)
driver.maximize_window()
driver.get ('https://www.flipkart.com/')
driver.implicitly_wait(30)
element=driver.find_element_by_link_text("Login").click()
driver.implicitly_wait(30)
element=driver.find_element_by_xpath("//input[@type ='password']").send_keys("hello")
driver.close()

只需輸入用戶名和密碼並輸入。

driver.get ('https://www.flipkart.com/')
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.XPATH, "//span[text()='Enter Email/Mobile number']/parent::label/parent::div/input"))).send_keys("hello")
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@type ='password']"))).send_keys("hello",Keys.ENTER)

進口

from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM