尝试用硒自动化 surveymonkey
Trying to automate surveymonkey with selenium
我正在编写一个 selenium 测试用例来自动化 surveymonkey。
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("-incognito --no-sandbox")
driver = webdriver.Chrome(executable_path='/usr/lib64/chromium/chromedriver', chrome_options=chrome_options)
driver.get('https://www.surveymonkey.com/r/WXNXWVB')
time.sleep(3)
vote_check = driver.find_element_by_id('96247410_725897453')
vote_check.click()
time.sleep(3)
nxt_btn = driver.find_element_by_name('Done')
nxt_btn.click()
driver.quit()
我得到了流动错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <input id="96247410_725897453" name="96247410" type="radio" class="radio-button-input" value="725897453"> is not clickable at point (850, 203). Other element would receive the click: <span class="radio-button-display ">...</span>
我做错了什么?
请找到以下可用代码:
对于选项 1:
vote_check = driver.find_element_by_xpath("//label[@for='96247410_725897453']")
对于选项 2:
vote_check = driver.find_element_by_xpath("//label[@for='96247410_725897454']")
完成:
vote_check = driver.find_element_by_xpath("//button[contains(text(), ' Done')]")
在你这边试试然后告诉我。
我正在编写一个 selenium 测试用例来自动化 surveymonkey。
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("-incognito --no-sandbox")
driver = webdriver.Chrome(executable_path='/usr/lib64/chromium/chromedriver', chrome_options=chrome_options)
driver.get('https://www.surveymonkey.com/r/WXNXWVB')
time.sleep(3)
vote_check = driver.find_element_by_id('96247410_725897453')
vote_check.click()
time.sleep(3)
nxt_btn = driver.find_element_by_name('Done')
nxt_btn.click()
driver.quit()
我得到了流动错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <input id="96247410_725897453" name="96247410" type="radio" class="radio-button-input" value="725897453"> is not clickable at point (850, 203). Other element would receive the click: <span class="radio-button-display ">...</span>
我做错了什么?
请找到以下可用代码:
对于选项 1:
vote_check = driver.find_element_by_xpath("//label[@for='96247410_725897453']")
对于选项 2:
vote_check = driver.find_element_by_xpath("//label[@for='96247410_725897454']")
完成:
vote_check = driver.find_element_by_xpath("//button[contains(text(), ' Done')]")
在你这边试试然后告诉我。