Skip to content

How to add options #1221

Answered by mdmintz
c350147221 asked this question in Q&A
Feb 15, 2022 · 4 comments · 31 replies
Discussion options

You must be logged in to vote

@c350147221 There's --chromium-arg=ARG for a comma-separated list of Chromium args, but that's for chrome_options.add_argument(). For changing the profile, you'll need to override get_new_driver() from BaseCase.
Here's an example of that:

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.h…

Replies: 4 comments 31 replies

Comment options

You must be logged in to vote
20 replies
@mdmintz
Comment options

@hasanzaibak
Comment options

@mdmintz
Comment options

@hasanzaibak
Comment options

@mdmintz
Comment options

Answer selected by mdmintz
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@naresh237
Comment options

@mdmintz
Comment options

@naresh237
Comment options

@mdmintz
Comment options

@naresh237
Comment options

Comment options

You must be logged in to vote
5 replies
@nakodavati
Comment options

@mdmintz
Comment options

@SMTamim
Comment options

@mdmintz
Comment options

@SMTamim
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants