-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
Hello, good day. I don't know how to add this type of options for Chrome, but using SeleniumBase. Thanks in advance for the help.
Example:
options.add_argument(f"user-agent={user_agent}")
options.add_argument('--start-maximized')
options.add_argument('disable-web-security')
options.add_argument('disable-extensions')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--disable-blink-features=AutomationControlled')
Beta Was this translation helpful? Give feedback.
All reactions
The answer depends on which of the 23 SeleniumBase Syntax Formats you use.
If you're running tests with pytest
, there are several command-line options available: (See pytest Options).
Eg. You can set the agent with --agent=AGENT
. Start maximized with --maximize
. Add any option you want with a comma-separated list: --chromium-arg="ARG1,ARG2=SOMETHING"
.
Find example tests in SeleniumBase/examples. (The pytest
ones start with test_
or end in _test.py
.)
You can also override browser_launcher.py
with Syntax Format 9 or 10 and use options.add_argument()
directly, but you will lose all the special SeleniumBase modes such as UC Mode (the most popular one). Example: test_override_driver.py.
If you...
Replies: 1 comment
-
The answer depends on which of the 23 SeleniumBase Syntax Formats you use.
If you're running tests with pytest
, there are several command-line options available: (See pytest Options).
Eg. You can set the agent with --agent=AGENT
. Start maximized with --maximize
. Add any option you want with a comma-separated list: --chromium-arg="ARG1,ARG2=SOMETHING"
.
Find example tests in SeleniumBase/examples. (The pytest
ones start with test_
or end in _test.py
.)
You can also override browser_launcher.py
with Syntax Format 9 or 10 and use options.add_argument()
directly, but you will lose all the special SeleniumBase modes such as UC Mode (the most popular one). Example: test_override_driver.py.
If you're using the Driver() manager format, there are several method args available, such as agent="AGENT"
, maximize=True
, chromium_arg="ARG1,ARG2=SOMETHING"
, etc. Example: raw_driver_manager.py.
Note that many of your options are already set by default. (Find them in seleniumbase/core/browser_launcher.py) If you try to set something twice that was already set, you may encounter issues. (This could be possible if you are setting options with chromium_arg
instead of via standard SeleniumBase options or method args.)
Beta Was this translation helpful? Give feedback.