我刚刚开始了我的第一个项目,使用的是使用python的selenium。我的第一个任务是使用'Sign to chrome‘按钮登录到chrome,但我就是不能点击它:Sign to chrome button
按钮HTML:
<paper-button class="action-button" role="button" tabindex="0" animated="" aria-disabled="false" elevation="0">
Sign in to Chrome
</paper-button>这是链接:chrome://settings/people
我试过了:
driver = webdriver.Chrome()
driver.find_element_by_class_name('action-button').click()
driver.find_element_by_xpath('//paper-button[@class='action-button']').click()
driver.find_element_by_css_selector('paper-button.action-button').click()什么都不管用。
错误:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"paper-button:not([raised]).action-button"}发布于 2019-01-22 00:08:32
请尝试使用AutoIt pip,您可以尝试以下代码:
安装Autoit:
pip install -U pyautoit 使用以下代码:
from selenium import webdriver
import autoit
driver = webdriver.Chrome()
driver.get("chrome://settings/")
autoit.send('{TAB}{TAB}{ENTER}')如果它起作用了,请告诉我。
https://stackoverflow.com/questions/54293227
复制相似问题