Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
324 views
in Technique[技术] by (71.8m points)

python - Parsing error when logging into website with headless set to 'True' using Selenium

This program is supposed to login into a website called PowerSchool. I get a parsing error when headless is True, however, which I don't understand since it works otherwise. I've looked at several other questions on this site and a few YouTube tutorials to no avail.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

username = 'my username is usually here'
password = 'my password is usually here'

options = Options()
options.headless = True
driver = webdriver.Chrome('chromedriver.exe', options=options)
driver.get('https://sis.henrico.k12.va.us/public/home.html')

user_input = driver.find_element_by_id('fieldAccount')
user_input.send_keys(username)
pass_input = driver.find_element_by_id('fieldPassword')
pass_input.send_keys(password)

login_button = driver.find_element_by_id('btn-enter-sign-in')
login_button.click()

With options.headless to False, it logs into the website on the screen and then closes the browser. When I set options.headless to true, it waits a second and then gives me ..."Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead."... This shows twice, effectively. I'm not sure what is causing the problem. Any solution?

question from:https://stackoverflow.com/questions/65838787/parsing-error-when-logging-into-website-with-headless-set-to-true-using-seleni

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...