How to add options #1221
-
hi, How to add options? as follows opt = Options() |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 31 replies
-
@c350147221 There's from selenium import webdriver
from seleniumbase import BaseCase
class OverrideDriverTest(BaseCase):
def get_new_driver(self, *args, **kwargs):
""" This method overrides get_new_driver() from BaseCase. """
options = webdriver.ChromeOptions()
options.add_experimental_option(
"excludeSwitches", ["enable-automation"]
)
options.add_experimental_option("useAutomationExtension", False)
if self.headless:
options.add_argument("--headless")
return webdriver.Chrome(options=options)
def test_simple(self):
self.open("https://seleniumbase.io/demo_page")
self.assert_text("Demo Page", "h1") |
Beta Was this translation helpful? Give feedback.
-
If you are only trying to enable camera and audio, the answer in post #1566 would be easier. |
Beta Was this translation helpful? Give feedback.
-
@mdmintz i am using docker setup for my seleniumbase test cases, using chrome version 111.0.5563.19-1, and chrome driver version 111.0.5563.19, python version 3.9.6 , seleniumbase==4.14.8 , selenium==4.9.1, it seems there is no compatibility issues here , but when i am running inside my container i am getting " urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))" this error , tried all options and not solved yet . i have overrided get_new_driver and using this def get_new_driver(self, *args, **kwargs): |
Beta Was this translation helpful? Give feedback.
-
Looks like you have a typo in your modified version. Should be “google-chrome-stable”. |
Beta Was this translation helpful? Give feedback.
@c350147221 There's
--chromium-arg=ARG
for a comma-separated list of Chromium args, but that's forchrome_options.add_argument()
. For changing the profile, you'll need to overrideget_new_driver()
from BaseCase.Here's an example of that: