我正在使用Python3,并使用Selenium在浏览器中单击单选按钮。我能够找到要点击的Radio元素。但是,当我执行Element.click()
时,它会给我一个错误:
Message: unknown error: Element <Description of Element> is not clickable at point (340, 190).
Other element would receive the click: <Description of some other element>.
浏览器中显示的单选元素为:
<input data-val="true" data-val-required="Required" id="Promoter" name="Type" onchange="Checkboxck('Promoter')" type="radio" value="Promoter" />
我查找此单选元素并单击它的代码是:
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
Registered_Project_RadioButton.click()
发布于 2019-04-20 14:16:36
使用Actions类或Java Script Executor来实现这一点。
from selenium.webdriver.common.action_chains import ActionChains
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
ActionChains(browser).move_to_element(Registered_Project_RadioButton).click().perform()
或
Registered_Project_RadioButton = browser.find_element_by_id("Promoter")
browser.execute_script("arguments[0].click();", Registered_Project_RadioButton)
https://stackoverflow.com/questions/55773529
复制