您好,我尝试在 python 中的 selenium 驱动程序的帮助下单击一个单选按钮,但它不起作用。这是 HTML 代码:
<input aria-flowto="aria8" aria-label="private key" type="radio" ng-model="walletType" value="pasteprivkey" class="ng-pristine ng-valid ng-empty ng-touched" name="200">
这是我的代码行:
browser.find_elements_by_xpath("input[type='radio'][value='pasteprivkey']").click()
我收到此错误:
DevTools listening on ws://127.0.0.1:52666/devtools/browser/da96711c-0446-c01-a90d-0f722691ec4c
Traceback (most recent call last):
File "C:\Users\Andrei\Desktop\py\teste.py", line 6, in <module>
browser.find_element_by_xpath("//*[@type='radio'][@value='pasteprivkey']").click()
File "C:\Users\Andrei\AppData\Local\Programs\Python\Python37\lib\site-packages
\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Andrei\AppData\Local\Programs\Python\Python37\lib\site-packages
\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:\Users\Andrei\AppData\Local\Programs\Python\Python37\lib\site-packages
\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:\Users\Andrei\AppData\Local\Programs\Python\Python37\lib\site-packages
\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 6.1.7601 SP1 x86_64)
有人可以帮我吗?我还尝试使用检查元素复制 xpath,但我得到了这个奇怪的东西:
/html/body/section[1]/div[1]/main/article[1]/div[2]/wallet-decrypt-drtv/article/section[1]/label[9]/input
回首忆惘然
相关分类