codeforequity-at / botium-core

The Selenium for Chatbots - Bots Testing Bots
https://www.botium.ai
MIT License
229 stars 64 forks source link

Unable to communicate with Chatbot on website from my Botium and the intraction is inconsistant....!!!!!!(botium-connector-webdriverio) #584

Closed divyakumar95 closed 3 years ago

divyakumar95 commented 3 years ago

Describe the bug Hi, I am trying to communicate with a chatbot which is on a website, I could establish the connection with the chatbot via botium-connector-webdriverio (which is inconsistent), when connected the bot response is not captured properly on the emulator & convo file and the text I send to the bot is also echoed as the "bot says" always unable to test the bot which is on the website as expected, please help me fix this issue!!!!!!!!!!!............................ Bot response on the website is perfect and quick as expected but its not working the same using Botium...!!!!!

To Reproduce Installed Botium-cli Installed Botium-connector-webdriverio npx botium-cli emulator

Screenshots and Log files C:\Users\divyakn\Desktop\my-project\Botium_website_chatbot\CHAT-AI\samples\custom>npx botium-cli emulator Starting ChromeDriver 86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}) on port 43117 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. [1114/095820.000:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. DevTools listening on ws://127.0.0.1:49902/devtools/browser/916a53aa-523d-4865-85b5-122ffa7afc13 [1114/095825.012:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095827.588:INFO:CONSOLE(0)] "Refused to execute script from 'https://www.pepco.com/Pages/default.aspx' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.", source: https://www.pepco.com/Pages/default.aspx (0) [1114/095828.431:INFO:CONSOLE(201)] "chat connected", source: https://www.pepco.com/Style%20Library/Exelon/DigitalAssistant/scripts/digitalassistant.js (201) [1114/095828.876:ERROR:ssl_client_socket_impl.cc(960)] handshake failed; returned -1, SSL error code 1, net_error -202 [1114/095829.263:ERROR:ssl_client_socket_impl.cc(960)] handshake failed; returned -1, SSL error code 1, net_error -202


| ) / \ | | | | | | | | | \/ | | \ | | | | | | | | | | | | | |\/| | | |) | | || | | | | | | || | | | | | |____/ \/ |_| || \/ || ||

Chatbot online. Enter "#SAVE " to save your conversation into your convo-directory, #EXIT to quit or just a message to send to your Chatbot! [1114/095837.677:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095842.688:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095847.696:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. H[1114/095852.706:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. el[1114/095853.027:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. lo BOT SAYS (default): Hello [1114/095857.720:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095900.302:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095905.300:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095905.314:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095910.310:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095910.323:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095915.318:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1114/095915.332:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. Hi BOT SAYS (default): Hi @@ BOT SAYS (default): @@ [1114/095931.815:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. BOT SAYS (default): I’m sorry I couldn’t help you here. Let’s try something else. For more help, you can choose from the options below. Start Another Chat End Chat Contact Us

[1114/095936.823:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig.

[1114/095942.244:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. BOT SAYS (default): ## BOT SAYS (default): You can find your account number in the upper left-hand corner of your bill. Here's a sample bill that shows where your account number appears. If you are registered for an online My Account, you can also simply login to view your account number. BOT SENDS BUTTONS (default): *TEXT: sample bill PAYLOAD: https://www.pepco.com/MyAccount/MyBillUsage/Pages/UnderstandingMyBill.aspx BOT SAYS (default): Did you find the answer(s) you needed today? Yes No [1114/095947.255:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. he[1114/095958.274:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. llo BOT SAYS (default): hello HI [1114/100003.286:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. BOT SAYS (default): HI [1114/100013.309:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. $ BOT SAYS (default): $ BOT SAYS (default): I can help you with billing questions. What would you like to know more about? Paying Your Bill Payment Plans and Bill Assistance Programs Questions About Your Bill Getting Your Bill Account Balance [1114/100018.330:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. Conversation written to file C:\Users\divyakn\Desktop\my-project\Botium_website_chatbot\CHAT-AI\samples\custom\hellobot.convo.txt

exit

Botium stopping ... Botium stopped

Additional context Adding my config file (botium.json)

{ "botium": { "Capabilities": { "PROJECTNAME": "WebdriverIO Plugin Sample", "CONTAINERMODE": "webdriverio", "CLEANUPTEMPDIR": true, "WEBDRIVERIO_URL": "https://www.pepco.com/Pages/default.aspx", "_WEBDRIVERIO_OPENBOT": "./snippets/openbot", "__WEBDRIVERIO_OPENBOT": "./snippets/openbot_promises", "WEBDRIVERIO_OPENBOT": "module.exports = container.findElement('.oda-chat-button').then(ccBtn => ccBtn.waitForClickable({ timeout: 40000}).then(() => ccBtn.click())).then(() => container.findElement('.oda-chat-button-icon')).then(startChat => startChat.waitForClickable({ timeout: 40000}).then(() => startChat.click()))", "__WEBDRIVERIOOPENBOT": "module.exports = (async () => { const ccBtn = await container.findElement('.oda-chat-button'); await ccBtn.waitForClickable({ timeout: 40000});await ccBtn.click();const startChat = await container.findElement('.oda-chat-button-icon');await startChat.waitForClickable({ timeout: 40000});await startChat.click();})()", "WEBDRIVERIO_OPENBOT": "module.exports = async () => { const ccBtn = await container.findElement('.oda-chat-button'); await ccBtn.waitForClickable({ timeout: 40000});await ccBtn.click();const startChat = await container.findElement('.oda-chat-button-icon');await startChat.waitForClickable({ timeout: 40000});await startChat.click();}", "___WEBDRIVERIO_INPUT_NAVIGATION_BUTTONS": [ ".oda-chat-button", ".oda-chat-button-icon" ], "WEBDRIVERIO_INPUT_ELEMENT": ".oda-chat-user-input", "WEBDRIVERIO_INPUT_ELEMENT_SENDBUTTON": "/html/body/div[3]/div/div[3]/button", "WEBDRIVERIO_OUTPUT_ELEMENT": ".oda-chat-content-wrapper", "WEBDRIVERIO_OUTPUT_ELEMENT_HASH": "HASH", "WEBDRIVERIO_OUTPUT_ELEMENT_HASH_SELECTOR": "./div[contains(@class,'oda-chat-message-bubble')]/div[contains(@class,'oda-chat-message-content')]", "WEBDRIVERIO_IGNOREWELCOMEMESSAGES": 1, "WEBDRIVERIO_START_CHROMEDRIVER": true } } }

codeforequity-at commented 3 years ago

thanks for the detailed trace. I will try this myself and get back to you in 2-3 days.

divyakumar95 commented 3 years ago

Hi, Can u please let me know how to proceed further...

codeforequity-at commented 3 years ago

Try it with this botium.json:

{
  "botium": {
    "Capabilities": {
      "PROJECTNAME": "WebdriverIO Plugin Sample",
      "CONTAINERMODE": "webdriverio",
      "WAITFORBOTTIMEOUT": 60000,
      "CLEANUPTEMPDIR": false,
      "WEBDRIVERIO_URL": "https://www.pepco.com/Pages/default.aspx",
      "WEBDRIVERIO_INPUT_ELEMENT": ".oda-chat-user-input",
      "WEBDRIVERIO_INPUT_NAVIGATION_BUTTONS": [ ".oda-chat-button-icon" ],
      "WEBDRIVERIO_INPUT_ELEMENT_SENDBUTTON": ".oda-chat-button-send",
      "WEBDRIVERIO_OUTPUT_ELEMENT": ".oda-chat-left",
      "WEBDRIVERIO_OUTPUT_ELEMENT_TEXT": ".oda-chat-message-content",
      "WEBDRIVERIO_OUTPUT_ELEMENT_BUTTONS": ".oda-chat-action-postback",
      "WEBDRIVERIO_OUTPUT_ELEMENT_HASH": "TEXT",
      "WEBDRIVERIO_START_CHROMEDRIVER": true
    }
  }
}
divyakumar95 commented 3 years ago

Hi,

Thanks for the update, The same JSON file did not work but with slight modification (modification done by me was in "WEBDRIVERIO_INPUT_NAVIGATION_BUTTONS": [".oda-chat-button",".oda-chat-button-icon" ]), it worked and I find a new problem when trying to run any commands mentioned below -

botium-cli emulator
botium-cli run -C convo/path

Most of the time running the script, I find the issues of the timeout and element still not displayed I have kept the "WAITFORBOTTIMEOUT": 60000 timeouts in botium.json this works for 2 times and does not work for 4-5 times for every time I run the same JSON file

attaching log for reference : C:\Users\divyakn\Desktop\Botium\WebChannel>botium-cli run -C test_cases\working\HighBill.convo.txt

Botium Test-Suite Starting ChromeDriver 86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}) on port 41565 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. [1118/214316.113:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig.

DevTools listening on ws://127.0.0.1:52926/devtools/browser/497363d5-9d86-4071-908e-b21e73e1818c [1118/214321.122:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1118/214324.361:ERROR:ssl_client_socket_impl.cc(960)] handshake failed; returned -1, SSL error code 1, net_error -202 [1118/214324.364:ERROR:ssl_client_socket_impl.cc(960)] handshake failed; returned -1, SSL error code 1, net_error -202 [1118/214324.988:INFO:CONSOLE(0)] "Refused to execute script from 'https://www.pepco.com/Pages/default.aspx' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.", source: https://www.pepco.com/Pages/default.aspx (0) [1118/214326.131:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. [1118/214326.917:INFO:CONSOLE(201)] "chat connected", source: https://www.pepco.com/Style%20Library/Exelon/DigitalAssistant/scripts/digitalassistant.js (201) [1118/214331.140:WARNING:dns_config_service_win.cc(692)] Failed to read DnsConfig. 1) "before each" hook for "Highbill" 2) "after each" hook for "Highbill"

0 passing (23s) 2 failing

1) Botium Test-Suite "before each" hook for "Highbill": Error: WebDriver error on startup: element (".oda-chat-user-input") still not displayed after 3000ms at BotiumConnectorWebdriverIO.Start (C:\Users\divyakn\AppData\Roaming\npm\node_modules\botium-connector-webdriverio\dist\botium-connector-webdriverio-cjs.js:536:13)

2) Botium Test-Suite "after each" hook for "Highbill":

divyakumar95 commented 3 years ago

Hi @codeforequity-at anything I can do to resolve this issue which I am facing right now

codeforequity-at commented 3 years ago

i tried around and i also had problems with this flakiness ... sometimes it worked, next time it didn't. when not in maximized mode, some other buttons are hiding the chatbot controls (at least in my screen resolution). My recommendation would be to tailer the Botium Websocket connector instead of using the webdriver connector. The chatbot is obviously using a simple JSON-based websocket protocol, you can see this in the chrome developer mode.

divyakumar95 commented 3 years ago

cool, let me check with it and get back. thanks a lot for your help

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.