The code below, when the headless option is commented out, works perfectly, it manages to click on the VIEW ALL button on the site, but when we include the headless option, the error is displayed: Message: element click intercepted: Element is not clickable at point. I've researched and tried everything imaginable, nothing works. Anyone with any good ideas? thanks
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
custom_user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36" # noqa
options = Options()
options.add_argument('--headless')
options.add_argument("start-maximized")
options.add_argument(f'user-agent={custom_user_agent}')
url = 'https://www.etf.com/SPY'
driver = webdriver.Chrome(options=options, service=Service(ChromeDriverManager().install())) # noqa
driver.get(url)
time.sleep(3)
body = driver.find_element(By.XPATH, '/html/body')
body.send_keys(Keys.PAGE_DOWN)
body.send_keys(Keys.PAGE_DOWN)
body.send_keys(Keys.PAGE_DOWN)
body.send_keys(Keys.PAGE_DOWN)
time.sleep(3)
driver.find_element(By.XPATH, '//*[@id="holdings"]/div[2]/div[1]/div[1]/div[2]/div/div/div[1]/div[2]/div[3]/button').click() # noqa
input('wait..')