Python Selenium WebDriver可以';t载荷剖面
我尝试使用Selenium WebDriver启动Firefox,但出现以下错误:Python Selenium WebDriver可以';t载荷剖面,python,firefox,selenium,Python,Firefox,Selenium,我尝试使用Selenium WebDriver启动Firefox,但出现以下错误: --------------------------------------------------------------------------- WebDriverException Traceback (most recent call last) <ipython-input-10-9e1140c380e1> in <module>(
---------------------------------------------------------------------------
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"
工作,而做
profile_name = '/home/ubuntu/.mozilla/firefox/amozqob6.profile6'
profile = webdriver.FirefoxProfile(profile_name)
w = webdriver.Firefox(firefox_profile=profile)
获取上述错误消息
编辑2:
直接运行Firefox可执行文件可以:
firefox -profile ~/.mozilla/firefox/amozqob6.profile6
帮助我指定二进制文件firefox的显式路径
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary("/home/teddy/firefox/firefox")
driver = webdriver.Firefox(firefox_binary=binary)
您是否能够在没有自定义配置文件的情况下启动Selenium会话?试着在远程启动一个普通的Firefox Webdriver实例。@SilasRay确实可以。我更新了问题。建议?我不太了解Firefox配置文件的内部结构,但作为第一个尝试,您是否碰巧创建了您在不同操作系统上使用的配置文件,而不是在AWS实例上使用的配置文件?我不知道FF配置文件是否可以跨操作系统移植。@SilasRay我是在本地Ubuntu 12 32位上创建的,而remote是16位。但是,它应该能工作,因为我以前做过。我最近不得不将Firefox从30升级到32(出于其他原因),并试图让一切都恢复正常,上一次我做的是在本地创建配置文件并复制到远程。远程是16位吗?你确定吗?也许你是说64岁?
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary("/home/teddy/firefox/firefox")
driver = webdriver.Firefox(firefox_binary=binary)