1

I am trying to install selenium 3 on mac using default python i.e. /usr/bin/python But when I try to install it https://pypi.org/project/selenium/ using

pip install selenium I get error Collecting selenium Using cached

https://files.pythonhosted.org/packages/41/c6/78a9a0d0150dbf43095c6f422fdf6f948e18453c5ebbf92384175b372ca2/selenium-3.13.0-py2.py3-none-any.whl
Installing collected packages: selenium
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/selenium'
Consider using the `--user` option or check the permissions.

If i install using --user as pip install --user selenium it works but when I run test with code

driver = webdriver.Safari(executable_path="/Users/Desktop/selenium-server-standalone-3.13.0.jar")

I get error

WebDriverException: Message: 'selenium-server-standalone-3.13.0.jar' executable may have wrong permissions. 

Why I'm getting error and is there a way to install without --user and sudo because even with these options it doesn't work.

4

1 回答 1

2

您通过使用解决了第一个问题--user- 第二个问题是一个不同的问题。

此行webdriver.Safari(executable_path=...)指向错误的路径 - 您应该将其指向savaridriversafari 10 附带的可执行文件的任何位置,而不是指向.jar文件。

像这样的东西:

driver = webdriver.Safari(executable_path='/Applications/Safari.app/Contents/MacOS/safaridriver')

只需检查您的 mac 中的路径并找出您safaridriver的位置。

于 2018-07-24T20:36:27.810 回答