Commit 4cc0d872 authored by Tricia Crichton's avatar Tricia Crichton Committed by Commit Bot

[ChromeDriver] Support download.default_directory for Headless

This CL enables users in headless mode to specify download.default_directory using
dot notation rather than constructing a nested dictionary. Support for
the nested syntax is maintained. This matches the behavior for headed mode.

Bug: chromedriver:3106
Change-Id: I8b225b83272b5ab15d176603bf6df43493c64a4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779427Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Tricia Crichton <triciac@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692278}
parent 0e8c2607
......@@ -317,8 +317,10 @@ Status InitSessionHelper(const InitSessionParams& bound_params,
if (session->chrome->GetBrowserInfo()->is_headless) {
std::string download_directory;
if (capabilities.prefs &&
capabilities.prefs->GetString("download.default_directory",
&download_directory))
(capabilities.prefs->GetString("download.default_directory",
&download_directory) ||
capabilities.prefs->GetStringWithoutPathExpansion(
"download.default_directory", &download_directory)))
session->headless_download_directory =
std::make_unique<std::string>(download_directory);
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment