Answer the question
In order to leave comments, you need to log in
Why is Selenium not finding the button in headless browser mode?
When starting the webdriver in normal mode (the browser window is visible), all buttons are pressed normally, in headless mode it
writes an error:
Message: no such element: Unable to locate element
The code itself:
opts = Options()
opts.add_argument('--headless')
driver = webdriver.Chrome(options = opts)
driver.maximize_window()
driver.find_element_by_xpath("//*[@id='free_bonus']/div/div[2]/div["+ config["SETTINGS"]["CHOICE_BONUS"] +"]/div[2]/span").click()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question