简体   繁体   English

Selenium WebDriver无法加载配置文件

[英]Selenium WebDriver can't load profile

I try firing up Firefox using Selenium WebDriver and get the following error: 我尝试使用Selenium WebDriver启动Firefox并收到以下错误:

---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-10-9e1140c380e1> in <module>()
----> 1 t = tweepi.Tweepi(username, 0, profile_name)

/home/ubuntu/twitter/tweepi.pyc in __init__(self, username, threadid, profilename)
     22             profile = webdriver.FirefoxProfile(profilename)
     23             self.logger.debug('launching firefox')
---> 24             self.driver = webdriver.Firefox(firefox_profile = profile)
     25         else:
     26             self.driver = webdriver.Firefox()

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy)
     57         RemoteWebDriver.__init__(self,
     58             command_executor=ExtensionConnection("127.0.0.1", self.profile,
---> 59             self.binary, timeout),
     60             desired_capabilities=capabilities,
     61             keep_alive=True)

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.pyc in __init__(self, host, firefox_profile, firefox_binary, timeout)
     45         self.profile.add_extension()
     46 
---> 47         self.binary.launch_browser(self.profile)
     48         _URL = "http://%s:%d/hub" % (HOST, PORT)
     49         RemoteConnection.__init__(

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.pyc in launch_browser(self, profile)
     62 
     63         self._start_from_profile_path(self.profile.path)
---> 64         self._wait_until_connectable()
     65 
     66     def kill(self):

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.pyc in _wait_until_connectable(self)
    106                 raise WebDriverException("Can't load the profile. Profile "
    107                       "Dir: %s Firefox output: %s" % (
--> 108                           self.profile.path, self._get_firefox_output()))
    109             count += 1
    110             time.sleep(1)

WebDriverException: Message: "Can't load the profile. Profile Dir: /tmp/tmp4nBIo5/webdriver-py-profilecopy Firefox output: None" 

Now, every other similar thread I found here on stackoverflow says the solution is to update selenium by using the command 现在,我在stackoverflow上找到的所有其他类似的线程说解决方案是使用命令更新selenium

pip install -U selenium pip install -U selenium

This fixed the problem on my local computer, but the problem persists on my remote computer on AWS. 这解决了我本地计算机上的问题,但问题仍然存在于AWS上的远程计算机上。 These two computers have the same Firefox version, both have selenium up-to-date and they even have the exact same profile folder on ~/.mozilla/firefox. 这两台计算机具有相同的Firefox版本,两者都有最新的selenium,甚至在〜/ .mozilla / firefox上也有完全相同的配置文件夹。

Any suggestions? 有什么建议?

EDIT: 编辑:

I can start Firefox without the profile. 我没有配置文件就可以启动Firefox。 That is, doing 那就是做

w = webdriver.Firefox()

works, whereas doing 工作,而做

profile_name = '/home/ubuntu/.mozilla/firefox/amozqob6.profile6'
profile = webdriver.FirefoxProfile(profile_name)
w = webdriver.Firefox(firefox_profile=profile)

gets the above error message. 得到上面的错误信息。

EDIT2: EDIT2:

Running the Firefox executable directly works: 直接运行Firefox可执行文件:

firefox -profile ~/.mozilla/firefox/amozqob6.profile6

helped me to specify an explicit path to the binary file firefox 帮我指定了二进制文件firefox的显式路径

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary("/home/teddy/firefox/firefox")
driver = webdriver.Firefox(firefox_binary=binary)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Selenium Webdriver错误:“无法加载配置文件” - Selenium Webdriver error: “Can't load the profile” python selenium webdriver问题(selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件。配置文件目录:) - python selenium webdriver issue ( selenium.common.exceptions.WebDriverException: Message: "Can't load the profile. Profile Dir: ) Python3.5 和 FF48 使用 Selenium WebDriver 出现“无法加载配置文件”错误 - "Can't load the profile" error occured with Selenium WebDriver by Python3.5 and FF48 Python:Selenium Firefox Webdriver失败并显示错误:&#39;无法加载配置文件... WARN addons.xpi ...“ - Python: Selenium Firefox Webdriver failing with error: 'Can't load the profile…WARN addons.xpi…" Selenium:FirefoxProfile 异常无法加载配置文件 - Selenium: FirefoxProfile exception Can't load the profile 无法在Debian上使用Selenium加载Chrome配置文件 - Can't load Chrome profile with Selenium on Debian Selenium Python Firefox webdriver:无法修改配置文件 - Selenium Python Firefox webdriver : can't modify profile Windows 7下的Selenium无法启动FirefoxDriver:无法加载配置文件 - Selenium under Windows 7 cannot start FirefoxDriver: Can't load profile WebDriverException:无法在selenium python脚本中加载配置文件错误 - WebDriverException:can't load profile error in selenium python script selenium.common.exceptions.WebDriverException:消息:无法加载配置文件 - selenium.common.exceptions.WebDriverException: Message: Can't load the profile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM