Python Selenium单击javascript单选按钮

Python Selenium单击javascript单选按钮,python,selenium,web,screen-scraping,Python,Selenium,Web,Screen Scraping,我是在我的脚本结束的权利,这一定是最后一页,我必须通过,我卡住了。我花了3个小时用不同的组合和不同的方法来加载元素 该页面使用大量javascript,因此当我尝试获取页面源代码时,它会提供给我 此页面使用框架,但您的浏览器不支持它们。 我已确定窗口中有两个框架,并尝试对这两个框架应用所有尝试 当我尝试并选择帧时的结果 **driver.find_element_by_xpath('''//*[@id="three"]/tbody/tr[2]/td/div[2]/a/input''').clic

我是在我的脚本结束的权利,这一定是最后一页,我必须通过,我卡住了。我花了3个小时用不同的组合和不同的方法来加载元素

该页面使用大量javascript,因此当我尝试获取页面源代码时,它会提供给我

此页面使用框架,但您的浏览器不支持它们。

我已确定窗口中有两个框架,并尝试对这两个框架应用所有尝试

当我尝试并选择帧时的结果

**driver.find_element_by_xpath('''//*[@id="three"]/tbody/tr[2]/td/div[2]/a/input''').click()**

error

**Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="three"]/tbody/tr[2]/td/div[2]/a/input"}**
我也试过在所有帧上使用或不使用
[0]
进行以下操作,但仍然存在相同的问题

**driver.find_element_by_xpath('.//input[@type="radio" and @value="05"]')[0].click**
我尝试过这个,但也得到了同样的错误

**element = driver.find_element_by_id("reason")**
下面是inspector窗口中代码的屏幕截图。

尝试使用驱动程序单击单选按钮

element = driver.find_element_by_xpath("//table[@id="three"]//input[@name="reason"]")
element.click();
或javascript执行器

element = driver.find_element_by_xpath("//table[@id="three"]//input[@name="reason"]")
driver.execute_script("arguments[0].click();", element)

首先尝试切换到包含的帧:

parent_frame=driver.find_element_by_css_selector('your selector')
driver.switch_to.frame(parent_frame)

#select the button after

请在问题中显示代码的相关部分,而不是截图。请参阅以了解有关此的更多信息