启动Huxley / Selenium记录会话时出错

时间:2014-07-09 16:39:58

标签: python selenium

我试图用Huxley开始新的记录时遇到问题。返回的异常错误如下:

------------------------------------
Running Huxley file: huxtestfile.txt
------------------------------------
[login] Running test: login
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python27\Lib\threading.py", line 808, in __bootstrap_inner
    self.run()
  File "C:\Python27\Lib\threading.py", line 761, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-        packages\huxley\threadpool.py", line 32, in thread
    func(*args, **kwargs)
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-packages\huxley\cmdline.py", line 69, in run_test
    screensize=screensize
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-packages\huxley\main.py", line 83, in main
    d = webdriver.Remote(remote, CAPABILITIES[browser])
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 72, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 115, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 166, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Test\projects\net10-test\net10-test\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 164, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: None ; Stacktrace:

我已将Huxley安装到python virtualenv中,并确保在尝试启动记录之前运行selenium服务器。我的huxley文件非常基础:

[login]
url=http://2.2.2.2/login.html

我已经确认我的网络应用程序可以从Firefox访问(使用上面的URL),我可以成功导航到127.0.0.1:4444/wd/hub

任何指针/建议都将不胜感激。如果我错过了任何必要的详细信息,请通知我,我会更新原帖。

THX。

更新:

Fiddler的进一步调查显示POST请求包含sessionID的NULL值。生成的NullPointerException错误似乎是我的未知错误的根本原因。

{"sessionId":null,"status":13,"value":    {"message":null,"localizedMessage":null,"suppressed":    [],"cause":null,"class":"java.lang.NullPointerException","hCode":3963113,"stackTrace":    [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,    null,null,null,null,null,null]},"state":"unhandled     error","class":"org.openqa.selenium.remote.Response","hCode":2501105}

我仍在尝试解决问题,我会再次使用我的结果进行更新。

1 个答案:

答案 0 :(得分:0)

问题是由于与Selenium 2.35和Firefox 30.0不兼容造成的 - 需要将Selenium更新到最新版本;但是,Huxley最初配置为仅根据此问题(https://github.com/facebook/huxley/issues/42

以2.35运行

按如下方式更新requires.txt:

selenium>=2.35.0
plac==0.9.1
Pillow==2.2.1
jsonpickle==0.4.0

允许huxley使用更新的Selenium版本运行。