selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/safaridriver

Viewed 552

Basically, on my Mac, selenium is not working. My code is as such:

from selenium import webdriver
webdriver.Safari('/usr/bin/safaridriver')

This is practically the most basic selenium script, yet it doesn't work... After 30 seconds of my program running, I get this error: selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/safaridriver. I have no idea why this is happening... my safari version is up to date, (14.0.1), yet I keep getting this error. Thanks for any help!

1 Answers

The first positional argument passed to webdriver.Safari isn't the executable_path argument, but is the port argument. You would have to pass the path as a positional argument.

webdriver.Safari(executable_path='/usr/bin/safaridriver')
Related