Myusico
Myusico

Reputation: 69

Headless Chrome keep popping deprecation

I am using a selenium headless Chrome on python to scrape a website. This website uses synchronous XMLHttpRequest, which is probably worse than asynchronous, but I don't really care (not my website). Each time my selenium webdriver visits this website, the Chrome deprecation message will be printed in my console:

"Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/."

How to stop this message from popping up?

Upvotes: 6

Views: 1776

Answers (3)

HITESH GUPTA
HITESH GUPTA

Reputation: 169

I faced this warning whenever I am using chrome driver with selenium. Normally, declare driver of chrome as:

driver = webdriver.Chrome(executable_path=PATH)

To this, we can pass one more argument, that is, options. Lets declare it first:

chrome_options = Options()
chrome_options.add_argument('--log-level=3') ## remove warining
chrome_options.add_argument("--headless") ## this will open chrome in backend, hence it will somehow boost processing.
driver = webdriver.Chrome(executable_path=PATH,options=chrome_options)

By this, warning will be removed. Thank you.

Upvotes: 2

Zeltrax
Zeltrax

Reputation: 1

This works like a charm.

chrome_options.add_argument('--log-level=3')

Upvotes: 0

leopon
leopon

Reputation: 31

This may have already been solved, but as this thread (link here) explains, adding a new argument will help.

options.add_argument("--log-level=3")

Upvotes: 3

Related Questions