Benjie
Benjie

Reputation: 45

Selenium - Python, cant find the element

I just started my first project with selenium using python. My first task is to login to chrome using 'Sign to chrome' button, but I just can't click it: Sign to chrome button

Button HTML:

<paper-button class="action-button" role="button" tabindex="0" animated="" aria-disabled="false" elevation="0">
                  Sign in to Chrome
                </paper-button>

This is the link: chrome://settings/people

I've tried:

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()

Nothing worked.

Error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"paper-button:not([raised]).action-button"}

Upvotes: 1

Views: 226

Answers (1)

Jitendra Banshpal
Jitendra Banshpal

Reputation: 555

Please try to use AutoIt pip and you can try below code:

Install Autoit:

pip install -U pyautoit 

Use below code:

from selenium import webdriver
import autoit
driver = webdriver.Chrome()
driver.get("chrome://settings/")
autoit.send('{TAB}{TAB}{ENTER}')

let me know if it works.

Upvotes: 1

Related Questions