leanne
leanne

Reputation: 8729

Where can I find a list of all available SafariOptions with Selenium?

I am looking for capabilities, preferences, and arguments that I can set with SafariOptions, SafariService, and webdriver.Safari in Selenium.

There are many answers out there regarding ChromeOptions and Firefox, and I've been able to use some. For example, I experimented with setting the window size and was able to get this to work: driver.set_window_size(width, height)

However, many things are not common between the various browsers.

I looked through Selenium's and Apple's documentation, but there are only a few examples. I was able to figure out how to use these:

options = webdriver.SafariOptions()
options.automatic_inspection = True    # activates the web inspector

service = webdriver.SafariService(service_args=["--diagnose"])   # activates logging

driver = webdriver.Safari(service=service, options=options)

# and, for capabilities, I found these in Selenium's documentation:
    browser_name = driver.capabilities['browserName']
    browser_version = driver.capabilities['browserVersion']

With FireFox, I am able to set preferences and arguments, like so:

options.set_preference('browser.download.dir', download_path)   # points to a specific download path

# and

options.add_argument('--headless')   # runs the firefox window in the background

I have found that Safari won't run headless; however, I do need to set an alternate download path. Also, Safari is automatically opening downloaded "safe" files. I need to turn that off. I know Safari has a preference to do that via the menu; however, what does that look like in my test settings?

Where can I find a full list of the capabilities and preferences I can use with Safari in Selenium?

Upvotes: 0

Views: 68

Answers (0)

Related Questions