Skip to content

Add the ability to set custom Chromium args. And update downloads. #846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 23, 2021

Conversation

mdmintz
Copy link
Member

@mdmintz mdmintz commented Mar 23, 2021

Add the ability to set custom Chromium args. And update downloads.

  • Add custom Chromium args with: --chromium-arg="ARG,ARG".
    -- (As demonstrated, this can be a comma-separated list)
    -- If there's already a specific command-line option for the custom argument that you want to include, you should use the built-in option instead in order to maximize SeleniumBase compatibility. (See help_docs/customizing_test_runs.md and seleniumbase/plugins/pytest_plugin.py for examples of command-line args.) You can also type: sbase options on the command-line for a list of the most popular command-line options to use with SeleniumBase.

  • Have get_downloads_folder() return the ./downloaded_files/ path.
    -- Note: SeleniumBase has always set the custom downloads folder to be ./downloaded_files/ from the location where tests are launched, however, Chromium Guest Mode (non-headless) does not allow the changing of the default system downloads folder, which is where files go when a browser click initiates a file download. This can be an issue if using BOTH Guest Mode AND clicking to download files, because then those files won't be in SeleniumBase's isolated environment. The good news is that download_file(file_url) will still always use the custom ./downloaded_files/ folder because only browser click-initiated downloads are impacted (and only for headed Guest Mode, IE, and Safari tests). So get_downloads_folder() will point to the SeleniumBase custom path one, and get_browser_downloads_folder() will point to the location where click-initiated browser downloads go. For most browsers (non-guest Chrome, Edge, Firefox) those methods will return the same location (./downloaded_files/). However, Guest Mode Chrome, Safari, and IE (where the system downloads folder can't be changed) will have two download locations, based on how your test downloads the file. (See examples/test_download_files.py and examples/test_shadow_dom.py for example tests that download files.)

@mdmintz mdmintz merged commit bf807a7 into master Mar 23, 2021
@mdmintz mdmintz deleted the custom-chromium-args branch March 23, 2021 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant