出于某种原因,我无法重新启动脚本

时间:2016-10-27 10:46:21

标签: node.js docker webdriver selenium-chromedriver webdriver-io

它曾经在我的docker堆栈上正常工作,我可以多次运行一个脚本,但最近,即使是这样的简单脚本

const webdriverio = require('webdriverio');
let options;
options = {
    desiredCapabilities: {
        browserName: 'chrome'
    },
    host: '192.168.99.100',
    port: 32777,
    path: '/wd/hub',
    logLevel: 'verbose'
};

const browser = webdriverio.remote(options);
browser.init()
.url('http://example.com')
.pause(2000)
.close()
.endAll();

只能运行一次,如果我停止并重新启动它就会挂起。 我有什么不对的吗?

这是它第一次运行的方式:

node test.js

[13:07:04]  COMMAND POST   "/wd/hub/session"
[13:07:04]  DATA    {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.8","name":"webdriverio"}}}
[13:07:06]  INFO  SET SESSION ID f38cd279-6ab9-4aca-9a4a-c55592831eaa
[13:07:06]  RESULT    {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":false,"chrome":{"chromedriverVersion":"2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3)","userDataDir":"/tmp/.org.chromium.Chromium.j7Q8e3"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":true,"version":"54.0.2840.59","platform":"LINUX","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"f38cd279-6ab9-4aca-9a4a-c55592831eaa","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true}
[13:07:06]  COMMAND POST   "/wd/hub/session/f38cd279-6ab9-4aca-9a4a-c55592831eaa/url"
[13:07:06]  DATA    {"url":"http://example.com"}
[13:07:07]  RESULT    null
[13:07:07]  COMMAND GET    "/wd/hub/session/f38cd279-6ab9-4aca-9a4a-c55592831eaa/title"
[13:07:07]  DATA    {}
[13:07:07]  RESULT    "Example Domain"
Example Domain
[13:07:09]  COMMAND GET    "/wd/hub/session/f38cd279-6ab9-4aca-9a4a-c55592831eaa/window_handles"
[13:07:09]  DATA    {}
[13:07:09]  RESULT    ["CDwindow-a5822994-4d02-4d05-b7d3-5e1f9e78bd4e"]
[13:07:09]  COMMAND DELETE   "/wd/hub/session/f38cd279-6ab9-4aca-9a4a-c55592831eaa/window"
[13:07:09]  DATA    {}
[13:07:09]  RESULT    null
[13:07:09]  COMMAND POST   "/wd/hub/session/f38cd279-6ab9-4aca-9a4a-c55592831eaa/window"
[13:07:09]  DATA    {"name":"CDwindow-a5822994-4d02-4d05-b7d3-5e1f9e78bd4e"}

这就是它第二次运行的方式

[13:17:59]  COMMAND POST   "/wd/hub/session"
[13:17:59]  DATA    {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.8","name":"webdriverio"}}}
[13:17:59]  COMMAND GET    "/wd/hub/sessions"
[13:17:59]  DATA    {}
^C

似乎无法设置会话ID

0 个答案:

没有答案