0

in this case, I use the argument (--headless) of chrome webdriver, the error message will happened my code is

chrome_options.add_argument('--headless')

if I give up the 'headless' option, the chrome will starup , and everting is going well, no error, and could continue running all the time

and every time, the error will happen at this code, it is a loop running function, totally 17 time, but will happen at the 4th time.

WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,'_tmp_'))).click()

without headless, everything is working perfectly, with headless, always stuck here, cannot understand why

blackcat
  • 107
  • 2
  • 7

1 Answers1

3

You can perform JavaScriptExecutor click on the element as it directly performs the action on the div and is not affected by the position of the element on the page or the headless option.
You can do it like:

button = driver.find_element_by_xpath("_tmp_")
driver.execute_script("arguments[0].click();", button)
Sameer Arora
  • 4,439
  • 3
  • 10
  • 20