0
Good afternoon, I am programming a python file using Lenium. I reached my goal and the file ran smoothly. I went further and decided to use the headless
, already at the beginning of the file execution I get an error:
in check_response raise exception_class(message, screen, stacktrace) Selenium.common.exceptions.Nosuchelementexception: Message: no such element: Unable to locate element: {"method":"css selector","selector":". whsOnd zHQkBf"} (Session info: headless Chrome=86.0.4240.198)**
Indicating that he was not able to identify the element on the page, only that this error persists also when trying to use the selector xpath
, class
, full xpath
and id
.
My code:
from time import sleep
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless")
driver = webdriver.Chrome(chrome_options=options, executable_path='C:/Users/Thunder/drivers/chromedriver.exe')
driver.get('https://classroom.google.com/u/1/c/MTIzNzc4MTM2NjY5')
sleep(8)
logan = driver.find_element_by_id('identifierId')
logan.send_keys('e-mail')
logan.send_keys(u'\ue007')
Have you tried using the option = Options() | option.headless = True?
– Elias Oliveira
Can specify better?
– Thunder - 41