codeforequity-at / botium-core

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

Propagation of phantomJS options #207

Closed xmichele closed 5 years ago

xmichele commented 5 years ago

Hello everybody, I have to say I'm very happy to use this useful tool! I'm using it with phantomJS 2.2.1 and Windows 10 to test a chatBot Widget with webdriverio containerMode. When using towards the chatbot HTTP site it works fine while with chatbot HTTPS site not. I already set in the botium.json conf file the variable "Envs": { "NODE_TLS_REJECT_UNAUTHORIZED": 0 } ; or "desiredCapabilities": {"acceptInsecureCerts":true, "acceptSslCerts":true } but the result error is "bot says nothing". I read that there are some phantomJS settings to overcome the problem (that I put in the JSON under desiredCapabilities as "PHANTOMJS_CLI_ARGS": ["--ignore-ssl-errors=true", "--ssl-protocol=any", "--web-security=false", "--webdriver-loglevel=DEBUG"] but with the same result. My doubt is that these new parameters have not been propagating to phantomJS ( maybe I have to use other JSON keys or value format ?)

Thanks

codeforequity-at commented 5 years ago

Now this is a problem I've never had before, hopefully we will find a solution. For my current knowledge, you did everything right - adding the settings to the desired Capabilities should actually work.

How do you start PhantomJS or your Selenium server ? Do you let Botium start PhantomJS, or do you start it manually ? What you can try: start phantomjs manually "phantomjs --webdriver=4444 --ignore-ssl-errors=true" before running Botium script

xmichele commented 5 years ago

Thanks for the fast response. Same result trying to start manually phantomjs --webdriver=4444 --ignore-ssl-errors=true and in a different cmd run botium-cli with "WEBDRIVERIO_START_PHANTOMJS": false

codeforequity-at commented 5 years ago

Can you please attach the log output here https://github.com/codeforequity-at/botium-core/wiki/Troubleshooting

xmichele commented 5 years ago

In the page link it seems that there is no place to attach the log output, or you mean in this thread?

codeforequity-at commented 5 years ago

the linked page just shows how to enable log output

xmichele commented 5 years ago

log botium says nothing.txt.txt

Please find attached the log : )

codeforequity-at commented 5 years ago

The log file shows:

But in the end, with the given output element selector, nothing is identified. So I would say, without knowing anything about your website, that the output element selector is pointing to nowhere and has to be changed.

xmichele commented 5 years ago

yes, it seems but I tested it with google chrome xPath finder succesfully. In addition, for the chatbot http version when I remove the option "WEBDRIVERIO_IGNOREUPFRONTMESSAGES":true, the first chatbot message is correctly identified while the others not. I used only last() xPath to get the last chatbot answer as below:

"//div[@class='chat-content']/div[@class='chatbot-chat'][last()]/div[@class='message']/p"

codeforequity-at commented 5 years ago

ah, you don't have to use this "last()" thing - the way Botium works is that it constantly monitors the DOM if new elements matching this selector appear.

xmichele commented 5 years ago

Thanks a lot, without last() works nice in HTTP! I have only the problem with httpS

codeforequity-at commented 5 years ago

the https thing is obscure. i tested it with badssl and received no error. what does the logfile say ? is there anything vusible on the screenshots ?

xmichele commented 5 years ago

It seems to open the page but not to detect elements (using the same chatbot in https vs http that works).When I tried to start phantomJs separatly, I read the flag useSslCerts: false but I don t know if it os the cause

codeforequity-at commented 5 years ago

I think the better place to ask this is a phantomjs/selenium forum.

xmichele commented 5 years ago

Ok, thanks