Selenium: safari Webdriver() throws AttributeError with default arguments for python client driver

Created on 7 Mar 2018  路  12Comments  路  Source: SeleniumHQ/selenium

Meta -

OS: linux
Selenium Version: 3.10.0
Browser: Safari/Version 11.0.3 (13604.5.6)

Expected Behavior -

launching webdriver.Safari() from python with default arguments should create a safaridriver instance

Actual Behavior -

AttributeError: 'WebDriver' object has no attribute 'service'

Steps to reproduce -

from selenium import webdriver
s = webdriver.Safari()
Traceback (most recent call last):
File "", line 1, in
File "/selenium/webdriver/safari/webdriver.py", line 49, in __init__
self.service.start()
AttributeError: 'WebDriver' object has no attribute 'service'

Most helpful comment

pull request created at branch python-safari-webdriver-defaultargs

All 12 comments

pull request created at branch python-safari-webdriver-defaultargs

PR merged as 2a0f63d19bd6e666ad432ee459762489d6b6033a

Sorry, is this fixed in later version of Selenium? I bump into the same problem here.

OS: MacOS 10.13.4
Selenium Version: 3.11.0
Browser: Safari/Version 11.1 (13605.1.33.1.2)

cd /usr/bin
ls | grep safari
# safaridriver
safaridriver --enable
from selenium import webdriver
webdriver.Safari()
# AttributeError: 'WebDriver' object has no attribute 'service'
webdriver.Safari(executable_path='/usr/bin/safaridriver')
# AttributeError: 'WebDriver' object has no attribute 'service'

The traceback I get is exactly the same with @mingeth's.

It is fixed in the trunk and will be in the next release

OS: MacOS 10.13.4
Selenium Version: 3.11.0
Browser: Safari/Version 11.1 (13605.1.33.1.2)

Hi, is this solved and release updated yet?

I get the same error as @mingeth and @corytu

File ".../selenium/webdriver/safari/webdriver.py", line 49, in __init__
self.service.start()
AttributeError: 'WebDriver' object has no attribute 'service'

@suchau3 Please see @lmtierney's comment right above yours.

It is fixed in the trunk and will be in the next release

@suchau3 @corytu the patch is a two liner -- not difficult to fix on your local.

how do we fix this locally? i am new to this.

Me too, can someone please help

You need to go to the directory where is saved your webdriver.py for Safari.
In my case it's /Users/YOUR_USER_NAME/vitenv/lib/python3.6/site-packages/selenium/webdriver/safari
After this you need to open webdriver.py and to add those 2 strings of the code that were added in the decision for this issue.

I get more errors after that, specifically which 2 lines should be appended and on which part of web driver.py

@swissbeats93 look higher up in the thread and you will see the PR merged commit (2a0f63d) by barancev on Mar 13. Click the link to the commit and it will show you the two lines and where to put them in your local copy of webdriver.py.

Was this page helpful?
0 / 5 - 0 ratings