0

我已经安装了 Botium-Binding 并准备我的机器按照文档安装 selenium-standalone 服务器,一旦一切都设置好,我已经在脚本文件夹https://github.com/codeforequity-at/botium-connector-webdriverio. 中的 botium.json 文件中添加了以下功能。samples/custom

"WEBDRIVERIO_OPTIONS": {    
        "capabilities": {
          "browserName": "chrome",
          
        }
      }

然后我运行了命令npm install && npm run mocha来触发跑步者。

我所看到的只是 Webdriver 会话正在创建并终止,并出现以下错误:

WebdriverIO Plugin Sample
Starting ChromeDriver 92.0.4515.107 (87a818b10553a07434ea9e2b6dccf3cbe7895134-refs/branch-heads/4515@{#1634}) on port 44325
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
    1) "before each" hook for "contractcancellation"


  0 passing (9s)
  1 failing

  1) WebdriverIO Plugin Sample
       "before each" hook for "contractcancellation":
     Error: WebDriver error on startup: Failed to create session.
Make sure to connect to valid hostname:port or the port is not in use.
If you use a grid server 
Make sure to add vendor prefix like "goog:", "appium:", "moz:", etc to non W3C capabilities.
See more https://www.w3.org/TR/webdriver/#capabilities

尝试将主机名、端口、平台添加到功能中,但没有用。寻求一些帮助,让我畅通无阻。

4

2 回答 2

0

我已使用您共享的链接启用详细日志记录。这是详细的日志记录。

up to date, audited 397 packages in 2s

57 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> custom@1.0.0 mocha
> mocha spec

  botium-bindings-main Botium Bindings args: {
  botium-bindings-main   convodirs: [ 'spec/convo' ],
  botium-bindings-main   expandConvos: true,
  botium-bindings-main   expandUtterancesToConvos: false
  botium-bindings-main } +0ms
  botium-core-BotDriver Loaded Botium configuration files /Users/xxxxxxxxx/Documents/botium/botium-connector-webdriverio/samples/custom/botium.json +0ms
  botium-core-ScriptingProvider ReadConvosFromDirectory(spec/convo) found filenames: contractcancellation.convo.txt,give_me_a_picture.convo.txt,hello.convo.txt,hyperlinks.convo.txt,tariff.convo.txt +0ms
  botium-core-ScriptingProvider ReadConvosFromDirectory(spec/convo) found convos:
  botium-core-ScriptingProvider  1 contractcancellation ({ convoDir: 'spec/convo', filename: 'contractcancellation.convo.txt' }): Line 3: #me - Hallo | Line 6: #bot - Hallo und willkommen | Line 9: #me - Ich möchte kündigen | Line 12: #bot - Möchten Sie ein Mobilfunk- oder ein Festnetz-Produkt kündigen? BUTTONS(Mobilfunk-Produkt,Festnetz-Produkt)
  botium-core-ScriptingProvider 2 give me picture ({ convoDir: 'spec/convo', filename: 'give_me_a_picture.convo.txt' }): Line 3: #me - Hello, Bot! | Line 6: #bot - You said: Hello, Bot! | Line 9: #me - give me a picture | Line 12: #bot - Here is a picture MEDIA(http://www.botium.at/img/logo.png)
  botium-core-ScriptingProvider 3 hello ({ convoDir: 'spec/convo', filename: 'hello.convo.txt' }): Line 3: #me - Hallo | Line 6: #bot - Hallo und willkommen
  botium-core-ScriptingProvider 4 hyperlinks ({ convoDir: 'spec/convo', filename: 'hyperlinks.convo.txt' }): Line 3: #me - Guthaben Aufladen | Line 6: #bot -  BUTTONS(Video zur Aufladung der Wertkarte)
  botium-core-ScriptingProvider 5 tariff ({ convoDir: 'spec/convo', filename: 'tariff.convo.txt' }): Line 3: #me - Hallo | Line 6: #bot - Hallo und willkommen | Line 9: #me -  BUTTON(Tarif wechseln) | Line 12: #bot - Ich verstehe, dass Sie Ihren Tarif wechseln möchten BUTTONS(Telefonie-Tarif,Internet-Tarif) +7ms
  botium-core-ScriptingProvider ReadConvosFromDirectory(spec/convo) found utterances:
  botium-core-ScriptingProvider  none +0ms
  botium-core-ScriptingProvider ReadConvosFromDirectory(spec/convo) found partial convos:
  botium-core-ScriptingProvider  none +0ms
  botium-core-ScriptingProvider ReadConvosFromDirectory(spec/convo) scripting memories:
  botium-core-ScriptingProvider  none +0ms
  botium-core-ScriptingProvider ExpandConvos - Using utterances expansion mode: all +0ms
  botium-bindings-main ready reading convos and utterances, number of test cases: (5). +200ms
  botium-bindings-main adding test case 1 contractcancellation +0ms
  botium-bindings-main adding test case 2 give me picture +0ms
  botium-bindings-main adding test case 3 hello +1ms
  botium-bindings-main adding test case 4 hyperlinks +0ms
  botium-bindings-main adding test case 5 tariff +0ms


  WebdriverIO Plugin Sample
  botium-core-BotDriver Build - Botium Core Version: 1.11.10 +205ms
  botium-core-BotDriver Build - Capabilites: {
  botium-core-BotDriver   PROJECTNAME: 'WebdriverIO Plugin Sample',
  botium-core-BotDriver   TESTSESSIONNAME: 'Botium Test Session',
  botium-core-BotDriver   TESTCASENAME: 'Botium Test Case',
  botium-core-BotDriver   TEMPDIR: 'botiumwork',
  botium-core-BotDriver   CLEANUPTEMPDIR: false,
  botium-core-BotDriver   WAITFORBOTTIMEOUT: 10000,
  botium-core-BotDriver   SIMULATE_WRITING_SPEED: false,
  botium-core-BotDriver   SIMPLEREST_PING_RETRIES: 6,
  botium-core-BotDriver   SIMPLEREST_PING_TIMEOUT: 10000,
  botium-core-BotDriver   SIMPLEREST_PING_VERB: 'GET',
  botium-core-BotDriver   SIMPLEREST_PING_UPDATE_CONTEXT: true,
  botium-core-BotDriver   SIMPLEREST_PING_PROCESS_RESPONSE: false,
  botium-core-BotDriver   SIMPLEREST_STOP_RETRIES: 6,
  botium-core-BotDriver   SIMPLEREST_STOP_TIMEOUT: 10000,
  botium-core-BotDriver   SIMPLEREST_STOP_VERB: 'GET',
  botium-core-BotDriver   SIMPLEREST_START_RETRIES: 6,
  botium-core-BotDriver   SIMPLEREST_START_TIMEOUT: 10000,
  botium-core-BotDriver   SIMPLEREST_START_UPDATE_CONTEXT: true,
  botium-core-BotDriver   SIMPLEREST_START_PROCESS_RESPONSE: true,
  botium-core-BotDriver   SIMPLEREST_START_VERB: 'GET',
  botium-core-BotDriver   SIMPLEREST_POLL_VERB: 'GET',
  botium-core-BotDriver   SIMPLEREST_POLL_INTERVAL: 1000,
  botium-core-BotDriver   SIMPLEREST_POLL_UPDATE_CONTEXT: true,
  botium-core-BotDriver   SIMPLEREST_METHOD: 'GET',
  botium-core-BotDriver   SIMPLEREST_IGNORE_EMPTY: true,
  botium-core-BotDriver   SIMPLEREST_TIMEOUT: 10000,
  botium-core-BotDriver   SIMPLEREST_EXTRA_OPTIONS: {},
  botium-core-BotDriver   SIMPLEREST_STRICT_SSL: true,
  botium-core-BotDriver   SIMPLEREST_INBOUND_UPDATE_CONTEXT: true,
  botium-core-BotDriver   SIMPLEREST_CONTEXT_MERGE_OR_REPLACE: 'MERGE',
  botium-core-BotDriver   SCRIPTING_TXT_EOL: '\n',
  botium-core-BotDriver   SCRIPTING_XLSX_EOL_WRITE: '\r\n',
  botium-core-BotDriver   SCRIPTING_XLSX_HASHEADERS: true,
  botium-core-BotDriver   SCRIPTING_CSV_SKIP_HEADER: true,
  botium-core-BotDriver   SCRIPTING_CSV_QUOTE: '"',
  botium-core-BotDriver   SCRIPTING_CSV_ESCAPE: '"',
  botium-core-BotDriver   SCRIPTING_NORMALIZE_TEXT: true,
  botium-core-BotDriver   SCRIPTING_ENABLE_MEMORY: false,
  botium-core-BotDriver   SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS: false,
  botium-core-BotDriver   SCRIPTING_MATCHING_MODE: 'wildcardIgnoreCase',
  botium-core-BotDriver   SCRIPTING_UTTEXPANSION_MODE: 'all',
  botium-core-BotDriver   SCRIPTING_UTTEXPANSION_RANDOM_COUNT: 1,
  botium-core-BotDriver   SCRIPTING_UTTEXPANSION_NAMING_MODE: 'justLineTag',
  botium-core-BotDriver   SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX: '16',
  botium-core-BotDriver   SCRIPTING_MEMORYEXPANSION_KEEP_ORIG: false,
  botium-core-BotDriver   SCRIPTING_FORCE_BOT_CONSUMED: false,
  botium-core-BotDriver   ASSERTERS: [],
  botium-core-BotDriver   LOGIC_HOOKS: [],
  botium-core-BotDriver   USER_INPUTS: [],
  botium-core-BotDriver   SECURITY_ALLOW_UNSAFE: true,
  botium-core-BotDriver   WEBDRIVERIO_OPTIONS: { capabilities: { browserName: 'chrome' } },
  botium-core-BotDriver   CONTAINERMODE: 'webdriverio',
  botium-core-BotDriver   WEBDRIVERIO_URL: 'https://www.drei.at',
  botium-core-BotDriver   _WEBDRIVERIO_OPENBOT: './snippets/openbot',
  botium-core-BotDriver   __WEBDRIVERIO_OPENBOT: './snippets/openbot_promises',
  botium-core-BotDriver   WEBDRIVERIO_OPENBOT: "module.exports = container.findElement('#onetrust-accept-btn-handler').then(ccBtn => ccBtn.waitForClickable({ timeout: 20000 }).then(() => ccBtn.click())).then(() => container.findElement('.troy__start-icon')).then(startChat => startChat.waitForClickable({ timeout: 20000 }).then(() => startChat.click()))",
  botium-core-BotDriver   ____WEBDRIVERIO_OPENBOT: "module.exports = (async () => { const ccBtn = await container.findElement('#onetrust-accept-btn-handler'); await ccBtn.waitForClickable({ timeout: 20000 });await ccBtn.click();const startChat = await container.findElement('#StartChat');await startChat.waitForClickable({ timeout: 20000 });await startChat.click();})()",
  botium-core-BotDriver   ___WEBDRIVERIO_OPENBOT: "module.exports = async () => { const ccBtn = await container.findElement('#onetrust-accept-btn-handler'); await ccBtn.waitForClickable({ timeout: 20000 });await ccBtn.click();const startChat = await container.findElement('#StartChat');await startChat.waitForClickable({ timeout: 20000 });await startChat.click();}",
  botium-core-BotDriver   WEBDRIVERIO_INPUT_ELEMENT: '#textInput',
  botium-core-BotDriver   ___WEBDRIVERIO_INPUT_NAVIGATION_BUTTONS: [ '#onetrust-accept-btn-handler', '.troy__start-icon' ],
  botium-core-BotDriver   WEBDRIVERIO_INPUT_ELEMENT_SENDBUTTON: '.troy__send',
  botium-core-BotDriver   WEBDRIVERIO_OUTPUT_ELEMENT: '.from-watson',
  botium-core-BotDriver   WEBDRIVERIO_OUTPUT_ELEMENT_HASH: 'HASH',
  botium-core-BotDriver   WEBDRIVERIO_OUTPUT_ELEMENT_HASH_SELECTOR: "./div[contains(@class,'message-inner')]/div[contains(@class,'text')]",
  botium-core-BotDriver   _WEBDRIVERIO_GETBOTMESSAGE: './snippets/getbotmessage',
  botium-core-BotDriver   WEBDRIVERIO_IGNOREWELCOMEMESSAGES: 1,
  botium-core-BotDriver   WEBDRIVERIO_START_CHROMEDRIVER: true,
  botium-core-BotDriver   __WEBDRIVERIO_HTTP_PROXY: 'http://127.0.0.1:8080',
  botium-core-BotDriver   __WEBDRIVERIO_HTTPS_PROXY: 'http://127.0.0.1:8080',
  botium-core-BotDriver   __WEBDRIVERIO_START_CHROMEDRIVER_ADDITIONAL_OPTIONS: '--ignore-certificate-errors'
  botium-core-BotDriver } +0ms
  botium-core-BotDriver Build - Sources : { LOCALPATH: '.', GITPATH: 'git', GITBRANCH: 'master', GITDIR: '.' } +1ms
  botium-core-BotDriver Build - Envs : { IS_BOTIUM_CONTAINER: true } +0ms
  botium-connector-PluginConnectorContainer-helper Botium plugin botium-connector-webdriverio loaded. Plugin version is 0.3.15 +0ms
  botium-connector-webdriverio Validate called +0ms
  botium-connector-webdriverio Loaded Capability WEBDRIVERIO_OPENBOT function as javascript +5ms
  botium-connector-webdriverio Build called +1ms
  botium-connector-webdriverio Starting Chrome with args: --port=41728,--url-base=wd/hub +0ms
Starting ChromeDriver 92.0.4515.107 (87a818b10553a07434ea9e2b6dccf3cbe7895134-refs/branch-heads/4515@{#1634}) on port 41728
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
  botium-connector-webdriverio Start called +6s
  botium-connector-webdriverio Webdriver Options: {"capabilities":{"browserName":"chrome","goog:chromeOptions":{"args":["--headless","--no-sandbox","--disable-gpu"]}},"logLevel":"silent","protocol":"http","hostname":"127.0.0.1","port":41728,"path":"/wd/hub"} +0ms
  botium-connector-webdriverio WebDriver error on startup: Failed to create session.
  botium-connector-webdriverio Make sure to connect to valid hostname:port or the port is not in use.
  botium-connector-webdriverio If you use a grid server 
  botium-connector-webdriverio Make sure to add vendor prefix like "goog:", "appium:", "moz:", etc to non W3C capabilities.
  botium-connector-webdriverio See more https://www.w3.org/TR/webdriver/#capabilities +1s
    1) "before each" hook for "contractcancellation"
  botium-connector-webdriverio Stop called +2ms
  botium-connector-webdriverio Clean called +0ms
  botium-connector-webdriverio Stopping chromedriver +0ms


  0 passing (9s)
  1 failing

  1) WebdriverIO Plugin Sample
       "before each" hook for "contractcancellation":
     Error: WebDriver error on startup: Failed to create session.
Make sure to connect to valid hostname:port or the port is not in use.
If you use a grid server 
Make sure to add vendor prefix like "goog:", "appium:", "moz:", etc to non W3C capabilities.
See more https://www.w3.org/TR/webdriver/#capabilities
      at BotiumConnectorWebdriverIO.Start (/Users/xxxxxxx/Documents/botium/botium-connector-webdriverio/index.js:694:13)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

看起来 webdriver 无法启动。而且我无法连接到日志中指定端口上的 webdriver。

于 2021-08-30T04:50:57.230 回答
0

您必须按照说明安装与您的 Chrome 版本匹配的 chromedriver 版本(如 pcalkins 上面所写)。

这无济于事,我建议启用详细日志记录以更深入地了解正在发生的事情。您可以在此处发布日志输出以进行进一步调查。

于 2021-08-28T08:28:36.207 回答