This change was implemented by the following commit:

https://chromium.googlesource.com/chromium/src/+/5b3168e8f8c4487320c654dd761622b89d548514

https://chromium-review.googlesource.com/c/chromium/src/+/5517510

Ignore beforeunload dialogs

According to WebDriver standard the alerts arising on beforeunload event
must never be shown in Classic session. This commit implements
autoacceptance of any beforeunload alerts.

It fixes the following bug:

https://issues.chromium.org/issues/42323796

To figure out in which release of ChromeDriver this commit was included you may use two methods:

#1 Append chrome/VERSION to the commit URL and open it in a browser

https://chromium.googlesource.com/chromium/src/+/5b3168e8f8c4487320c654dd761622b89d548514/chrome/VERSION

It will display the version information

#2 Navigate to this URL: https://chromiumdash.appspot.com/commits?platform=Windows

and enter commit hash in the search field.