Tyler Nielsen
Tyler Nielsen

Reputation: 615

ChromeDriver 78 Seems To Be Disabling allow-sync-xhr-in-page-dismissal Flag

The Problem

A few Chrome releases ago, Chrome deprecated a feature allowing for synchronous XHR during page dismissal. After several business complained of unforeseen impacts to business, they decided to default the behavior in Chrome 80 and allow for temporary workaround up until Chrome 82.

It seems that after upgrading to Chrome/ChromeDriver 78, we are seeing behavior in our application that is consistent with sync XHR on unload event being blocked. This behavior is only when ChromeDriver opens Chrome, I cannot reproduce when opening Chrome manually. This occurs even when no ChromeOptions are specified when opening Driver. While in ChromeDriver generated Chrome window, I navigate to chrome:\\flags and search for the #allow-sync-xhr-in-page-dismissal flag, I see it's set to 'default'. Upon setting to 'Enabled', our issue goes away. However, when I check this flag in my manually launched Chrome window, it's also set to 'default'. enter image description here

My Question

  1. Why does it seem behavior is different when launching via ChromeDriver vs. a manually opened Chrome session?

  2. What is the correct way to force ChromeDriver to set the #allow-sync-xhr-in-page-dismissal to enabled via ChromeOptions?

Upvotes: 0

Views: 2945

Answers (1)

Emil Chukarski
Emil Chukarski

Reputation: 26

To answer question 2:

chromeOptions.AddArgument("--enable-features=AllowSyncXHRInPageDismissal");

Upvotes: 1

Related Questions