selenium icon indicating copy to clipboard operation
selenium copied to clipboard

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

Open mingeth opened this issue 8 years ago • 12 comments

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'

mingeth avatar Mar 07 '18 21:03 mingeth

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

mingeth avatar Mar 07 '18 21:03 mingeth

PR merged as 2a0f63d19bd6e666ad432ee459762489d6b6033a

barancev avatar Mar 13 '18 06:03 barancev

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.

corytu avatar Apr 11 '18 02:04 corytu

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

lmtierney avatar Apr 11 '18 03:04 lmtierney

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'

ghost avatar Apr 12 '18 16:04 ghost

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

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

corytu avatar Apr 12 '18 16:04 corytu

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

mingeth avatar Apr 12 '18 17:04 mingeth

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

mithunsureshqa avatar Apr 18 '18 19:04 mithunsureshqa

Me too, can someone please help

swissbeats93 avatar Apr 21 '18 10:04 swissbeats93

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.

da-false9 avatar Apr 25 '18 04:04 da-false9

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

swissbeats93 avatar Apr 25 '18 09:04 swissbeats93

@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.

mingeth avatar Apr 27 '18 17:04 mingeth