启动时Selenium Webdriver异常

时间:2014-08-04 03:17:47

标签: python ubuntu selenium-webdriver

我试图第一次运行selenium webdriver。我的平台是64位Ubuntu 14.04上的python2.7。下面的脚本启动一个Firefox实例,暂停30秒左右,然后退出。

firefox和selenium都是使用apt-get安装的。

相关版本似乎是:

  • firefox:31.0 + build1-0ubuntu0.14.04.1
  • python-selenium:2.25.0-0ubuntu1

$ cat x.py 
#!/usr/bin/python2.7
from selenium import webdriver
try: driver = webdriver.Firefox()
except Exception as e: print e.msg
$ python x.py 
Can't load the profile. Profile Dir: /tmp/tmp6RP7Q9 Firefox output: 
(process:1705): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed

(firefox:1705): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::sm-connect after class was initialised

(firefox:1705): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised

(firefox:1705): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::display after class was initialised

(firefox:1705): GLib-GObject-WARNING **: Attempt to add property GnomeProgram::default-icon after class was initialised
1407121545974   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1407121545977   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1407121545980   addons.xpi  DEBUG   startup
1407121546015   addons.xpi  DEBUG   checkForChanges
1407121546027   addons.xpi  DEBUG   No changes found
1407121546035   addons.xpi  DEBUG   Registering manifest for /usr/lib/firefox/browser/extensions/langpack-en-ZA@firefox.mozilla.org.xpi
1407121546038   addons.xpi  DEBUG   Registering manifest for /usr/lib/firefox/browser/extensions/langpack-en-GB@firefox.mozilla.org.xpi

$ 

在Ubuntu上运行Firefox webdriver我该怎么做?

1 个答案:

答案 0 :(得分:0)

Ubuntu 14.04.1 LTS中的selenium-webdriver版本似乎已过时。试试这个:

$ sudo apt-get purge python-selenium
$ sudo pip install selenium