我已經設置了在Ubuntu操作系統中使用python & Selenium新創建的Firefox配置文件的路徑。但是,當我運行python腳本,我得到一個錯誤Python Selenium設置路徑到Firefox的配置文件(Ubuntu的)
OSError: [Errno 13] Permission denied
我已經改變的文件到755權限和我仍然得到錯誤,也嘗試須藤。
sudo chmod 775 /home/student/.mozilla/firefox/gwi6uqpe.Default\ User2/
這是我的Python腳本的開始: -
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.by import By
import sys, time
import time
binary = FirefoxBinary('/home/student/.mozilla/firefox/gwi6uqpe.Default User2')
browser = webdriver.Firefox(firefox_binary=binary)
這是錯誤消息。
Traceback (most recent call last):
文件 「default2.py」,第9行,在瀏覽器 = webdriver.Firefox(firefox_binary =二進制) 文件「/usr/local/lib/python2.7/dist-packages/selenium/webdriver /firefox/webdriver.py「,78行,init self.binary,timeout) 文件」/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py「 ,第51行,在init self.binary.launch_browser(self.profile,timeout = timeout) 文件「/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py 「第67行,位於launch_browser self._start_from_profile_path(self.profile.path) 文件「/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py」,第90行,in _start_from_profile_path ENV = self._firefox_env) 文件 「/usr/lib/python2.7/subprocess.py」,線710,在初始化 errread,ERRWRITE) 文件「/usr/lib/python2.7/subprocess .py「,第1327行,在_execute_child中 raise child_exception OSError:[Errno 13] Permission denied
請問我該如何解決這個問題。
是腳本正在使用的學生用戶。我曾嘗試給766權限建議,但我仍然得到相同的錯誤。謝謝。 – Newbe
我已檢查用戶對文件和文件夾的權限,並且都有rwx(讀寫執行) – Newbe
感謝您的幫助。完美運作。 – Newbe