大约70秒后,Selenium WebDriver崩溃(WebDriverError:newSession) [英] Selenium WebDriver crashes (WebDriverError: newSession) after about 70 seconds

查看:394
本文介绍了大约70秒后,Selenium WebDriver崩溃(WebDriverError:newSession)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我没有对代码进行任何更改以致使这种情况发生,但我对现有的,正在运行的项目开始发生的新错误感到困惑(但这可能是由于FireFox更新引起的,或者到一个依赖突然失败).开始发生之后,我确实添加了捕获以帮助调试导致突然退出的原因:

I'm baffled by this new error that started happening to my existing, working project, even though I didn't make any changes to code to cause this to happen (but it might have been due to a FireFox update, or to a dependency suddenly failing). After it started happening, I did add the catch to help debug what was causing the sudden quit:

var prom = new Builder()
  .forBrowser('firefox')
  .build()
prom.catch((e) => {
  console.log(e)
})
let driver: WebDriver = await prom

基本上,当我的代码到达此代码块的最后一行时,它会弹出一个FireFox窗口,等待约70秒(现在应该已经履行了诺言),然后引发一个错误,这才是问题所在并将其记录到控制台:

Basically, when my code gets to the last line of this code block, it pops up a FireFox window, waits about 70 seconds (should have fulfilled the promise by now), and then throws an error, which heads to the catch and logs it to the console:

{ WebDriverError: newSession
    at Object.throwDecodedError (\path\to\node_modules\selenium-webdriver\lib\error.js:550:15)
    at parseHttpResponse (\path\to\node_modules\selenium-webdriver\lib\http.js:542:13)
    at Executor.execute (\path\to\node_modules\selenium-webdriver\lib\http.js:468:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  name: 'WebDriverError',
  remoteStacktrace: 'WebDriverError@chrome://marionette/content/error.js:178:5\nUnknownCommandError@chrome://marionette/content/error.js:472:5\ndespatch@chrome://marionette/content/server.js:290:13\nexecute@chrome://marionette/content/server.js:271:11\nonPacket/<@chrome://marionette/content/server.js:246:15\nonPacket@chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n' }

有趣的是,当使用Visual Studio检查WebDriverError对象时,它说它具有message属性"newSession",由于某种原因它没有被记录到控制台(或在尝试时被字符串化).

Funny thing is, when inspecting the WebDriverError object using Visual Studio, it says it has a message property of "newSession" that for some reason doesn't get logged to the console (or stringified when I try that).

无论如何,该错误的构造不当,因为"newSession"在任何地方都没有告诉我足够多的信息来跟踪发生问题的地方.

Anyways, the error is poorly constructed because "newSession" doesn't tell me anywhere near enough information to track down what is going wrong.

有人可以帮助我确定等待70秒的时间吗?

Can anyone help me determine what it is waiting the ~70 sec for?

更新: 我确定了它正在等待的Web请求(到http://localhost:51290/session的POST,其中每次运行的端口都不同).此请求在70秒后超时.我可以通过将{}发送到URL(还会弹出Firefox窗口)在外部应用程序(例如SoapUI)中复制此超时时间.但是,如果我在SoapUI中将超时设置为巨大的值,则JSON响应当然是:

UPDATE: I determined the web request that it is waiting on (a POST to http://localhost:51290/session, where the port varies on each run). It is this request that times out after 70 seconds. I can duplicate this timeout in an external application (e.g. SoapUI) by sending {} to the URL (which also pops up a firefox window). However, if I set the timeout in SoapUI to something enormous, the JSON response is, of course:

{"value": {
   "error": "unknown error",
   "message": "newSession",
   "stacktrace": "WebDriverError@chrome://marionette/content/error.js:178:5\nUnknownCommandError@chrome://marionette/content/error.js:472:5\ndespatch@chrome://marionette/content/server.js:290:13\nexecute@chrome://marionette/content/server.js:271:11\nonPacket/<@chrome://marionette/content/server.js:246:15\nonPacket@chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n"
}}

我认为我需要调试FireFox方面,有人可以让我着手吗?

I'm thinking I will need to debug the FireFox side of this, can anyone get me started on that?

推荐答案

我刚刚找到了解决该问题的方法.我的Geckodriver已经过时了.更新GeckoDriver解决了该问题.

I just found the solution to that issue. My Geckodriver was outdated. Updating the GeckoDriver resolved the issue.

在OSX上,我要做的是:

On OSX What I had to do was:

brew uninstall geckodriver

然后

brew install geckodriver

希望有帮助!

这篇关于大约70秒后,Selenium WebDriver崩溃(WebDriverError:newSession)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆