2011-09-07 21 views
9

我使用python中的selenium webdriver自動驅動Firefox,python腳本是從Firefox中的selenium IDE插件中導出的。但是當我運行腳本時會引發錯誤:WebDriverException:無法在selenium python腳本中加載配置文件錯誤

 ====================================================================== 
    ERROR: test_selenium (__main__.SeleniumTest) 
    ---------------------------------------------------------------------- 
    Traceback (most recent call last): 
     File "selenium_test.py", line 8, in setUp 
     self.driver = webdriver.Firefox() 
     File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 46, in __init__ 

     self.binary, timeout), 
     File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 46, 
    in __init__ 
     self.binary.launch_browser(self.profile) 
     File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 44, in lau 
    nch_browser 
     self._wait_until_connectable() 
     File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 87, in _wa 
    it_until_connectable 
     raise WebDriverException("Can't load the profile. Profile Dir : %s" % self.profile.path) 
    WebDriverException: Can't load the profile. Profile Dir : c:\users\ataosky\appdata\local\temp\tmpwpz 
    zrv 

    ---------------------------------------------------------------------- 
    Ran 1 test in 67.876s 

    FAILED (errors=1) 

WebDriverException:無法加載配置文件。配置文件目錄:c:\ users \ ataosky \ appdata \ local \ temp \ tmpwpz

有沒有人遇到過這個問題?如何解決這個問題?提前致謝。

EDIE:硒2.5版本已經解決了這個問題。

+0

我們可以看到代碼? 我在C#中遇到過類似的問題,但不能在沒有看到代碼的情況下告訴你任何事情...... – Anders

+0

+1 - 與硒2.9.0相同的問題。懷疑它可能與最近的Firefox 8升級有關。 – hwjp

回答

11

在升級到Firefox 8時,運行selenium v​​ 2.9.0時,我遇到了這個問題。

它被修復爲升級到最新版本的硒(2.13)。

sudo pip install selenium --upgrade 

(如果你使用Python味)

+0

我有同樣的問題,但是我無法升級到Firefox 8,因爲硒2.9 +中的錯誤。我將不得不降級到Firefox 7,問題我在夜間測試運行期間會自動更新,並且在升級前我有我的Firefox首選項設置提示 –

+0

我也有過這個問題。自上次運行硒v2.2以來升級的FF。我已經升級到2.24,它執行Firefox作爲默認配置文件&沒有錯誤。 –

相關問題