尝试使用selenium自动化surveymonkey

时间:2017-03-24 09:23:56

标签: selenium selenium-chromedriver surveymonkey

我正在编写一个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 个答案:

答案 0 :(得分:0)

请找到以下可行代码:

对于选项1:

vote_check = driver.find_element_by_xpath("//label[@for='96247410_7258974‌​53']") 

对于选项2:

vote_check = driver.find_element_by_xpath("//label[@for='96247410_7258974‌​54']")

完成:

vote_check = driver.find_element_by_xpath("//button[contains(text(), ' Done')]")

尝试结束并告诉我。