在瓶上本地运行Selenium。我使用PhantomJS驱动程序。我以前有一个路径错误:WebDriverException:消息:'phantomjs'可执行文件可能具有错误的权限
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
但是从另一个StackOverflow的问题找出后,我才知道,我必须要通过环境路径作为PhantomJS参数。下面的路径是虚拟环境文件夹中phantomJS文件夹的路径。
driver = webdriver.PhantomJS(executable_path='/Users/MyAcc/Documents/MYWEBAPP/venv/lib/python3.5/site-packages/selenium/webdriver/phantomjs')
不过,我现在得到一个新的错误代码:
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable may have wrong permissions.
这里就是我得到的,当我检查路径的文件权限。
total 40
drwxr-xr-x 7 USER staff 238 Nov 6 00:07 .
drwxr-xr-x 17 USER staff 578 Nov 6 00:03 ..
[email protected] 1 USER staff 6148 Nov 6 00:07 .DS_Store
-rw-r--r-- 1 USER staff 787 Oct 31 12:27 __init__.py
drwxr-xr-x 5 USER staff 170 Oct 31 12:27 __pycache__
-rw-r--r-- 1 USER staff 2587 Oct 31 12:27 service.py
-rw-r--r-- 1 USER staff 2934 Oct 31 12:27 webdriver.py
当你列出目录'ls -al' - 'rwxrwxrwx'时有什么权限? – furas
'总40' 'drwxr-XR-X 7 USER人员238 11月6日0时07分.' 'drwxr-XR-×17 USER人员578 11月6日00:03 ..' '-rw-R --r - @ 1 USER staff 6148 Nov 6 00:07 .DS_Store' '-rw-r - r-- 1 USER staff 787 Oct 31 12:27 __init __。py' 'drwxr-xr-x 5 USER staff 170 Oct 31 12:27 __pycache__' '-rw -r - r-- 1 USER staff 2587 Oct 31 12:27 service.py' '-rw-r - r-- 1 USER staff 2934 Oct 31 12:27 webdriver.py' – Tahir
你解决了这个问题吗? Thasnk你 –