[英]Can't click button selenium
試圖按下按鈕,但沒有任何反應。 單擊時沒有錯誤,元素本身已定位。 元素可見。
有一個我的代碼:
verify = self.driver.find_element_by_xpath('//span[text()="Resend email"]')
ActionChains(self.driver).move_to_element(verify).click(verify).perform()
HTML:
<div class="Box-root Box-hideIfEmpty" style="pointer-events: auto;"><button class="UnstyledLink ButtonLink Flex-flex" type="button"><div class="Box-root Flex-flex Flex-alignItems--baseline Flex-direction--row" style="position: relative;"><div class="TextAligner Box-root" style="line-height: 20px; font-size: 14px; flex: 0 0 auto;"></div>
<div class="Box-root Flex-flex Flex-alignItems--baseline Flex-direction--row Flex-justifyContent--flexStart" style="line-height: 0; flex: 1 1 auto;"><span class="ButtonLink-label Text-color--blue Text-fontSize--14 Text-fontWeight--medium Text-lineHeight--20 Text-numericSpacing--proportional Text-typeface--base Text-wrap--noWrap Text-display--block" style="margin-top: -1px;">
<span>Resend email</span></span></div></div></button></div></div></div>
UPD:解決了這個問題。 如果您有同樣的問題,請嘗試更改瀏覽器配置文件/使用默認選項啟動
我能夠點擊它......不知道你這邊的問題是什么......
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox(executable_path=r'D:\geckodriver.exe')
driver.get('https://stripe.com/')
#click on Sign-in
driver.find_element_by_xpath('/html/body/header/div[1]/nav/ul/li[3]/a[2]/span').click()
#send email
driver.find_element_by_xpath('//*[@id="email"]').send_keys("abc@gmail.com")
#send password
driver.find_element_by_xpath('//*[@id="old-password"]').send_keys("akldjfkajdf")
#click on continue
driver.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div[2]/form/div/div/div/div[4]/div/div/div/div/div/div[1]/button/div/div[2]/span').click()
#click on skip for now
driver.find_element_by_xpath('/html/body/div/div/div[2]/div[3]/div/div/div/a/span').click()
#click on verify you email
driver.find_element_by_xpath('/html/body/div[2]/span/div/div/div[1]/div/div[2]/div[2]/div/span/div/div[4]/div[2]/div/div/div/div/div[1]/div/div/div/div[2]/div[2]/span/span').click()
#click on resend email
driver.find_element_by_xpath('/html/body/div[2]/span/div/div/div[1]/div/div[2]/div[2]/div/span/div/div[4]/div[2]/div/div/div/div[2]/div[2]/div/div/div/div/div[2]/button/div/div[2]/span/span').click()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.