It works well when done in non-headless mode but in headless mode no elements are detected.
code
url: https://moneyforward.com/users/sign_in
I wanna type into mail_address and password and click button in headless mode.
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import chromedriver_binary
options = Options()
options.add_argument("--headless")
options.add_argument("--disable-gpu")
driver = webdriver.Chrome(options=options)
driver.get("https://moneyforward.com/users/sign_in")
time.sleep(5)
# type into mail_address
driver.find_element_by_id('sign_in_session_service_email').send_keys({mail_address}])
# type into passowrd
driver.find_element_by_id('sign_in_session_service_password').send_keys({password})
# click login button
driver.find_element_by_id("login-btn-sumit").click()
The error statement is as follows.
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="sign_in_session_service_email"]"}
(Session info: headless chrome=80.0.3987.132)
Why doesn't it work in headless mode when it works in non-headless mode? Help me.