2

我在 EC2 上运行 fedora 19 XFCE,运行 python selenium 脚本时出现此错误...

E
======================================================================
ERROR: test_PROG (__main__.TEST_PROG)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "selenium_asda.py", line 24, in setUp
    self.driver = webdriver.Firefox()
  File "/usr/lib/python2.7/site-packages/selenium-2.36.0-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 60, in __init__
    self.binary, timeout),
  File "/usr/lib/python2.7/site-packages/selenium-2.36.0-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/lib/python2.7/site-packages/selenium-2.36.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 61, in launch_browser
    self._wait_until_connectable()
  File "/usr/lib/python2.7/site-packages/selenium-2.36.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable
    self._get_firefox_output())
WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: \n(process:22490): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0\' failed\nGtk-Message: Failed to load module "canberra-gtk-module"\n*** LOG addons.xpi: startup\n*** LOG addons.xpi: checkForChanges\n*** LOG addons.xpi: No changes found\n/usr/lib/firefox/firefox: relocation error: /tmp/tmpxzNZAo/extensions/fxdriver@googlecode.com/platform/Linux_x86-gcc3/components/libwebdriver-firefox-latest.so: symbol _Znwj, version xul24.0 not defined in file libxul.so with link time reference\n' 

----------------------------------------------------------------------
Ran 1 test in 5.193s

FAILED (errors=1)

该脚本在我的本地机器上运行良好......我认为这与 XFCE 的桌面设置有关。

我通过 vnc 连接到实例,可以毫无问题地获得完整的 XFCE 桌面。

有什么提示吗?

解决了:

我将 selenium 2.36 降级为 2.35 并且测试运行正常。

4

1 回答 1

2

该错误是由于浏览器不兼容造成的。我在尝试运行 FF24 时遇到了同样的事情。试试这里的教程,试着让它与 FF22 一起运行。

Selenium 的 Firefox 浏览器问题

于 2013-10-19T12:00:37.057 回答