1

I am doing a POC on Karate UI automation and have run into something. I am trying to read some text from a ChatBot we've placed on our companies web page and the div only has a class attribute. I have tried the following:

<div class="message bot-message bot-animation">Hi, I am the Assistant</div>

And waitForText('.messageCls','Hi, I am the Assistant')

Received the following error because it could not find it.

\feature:15 - javascript evaluation failed: waitForText('.messageCls','Hi, I am the Assistant'), wait failed for: .messageCls and condition: _.textContent.includes('Hi, I am the Assistant') after 21047 milliseconds

I've tried And waitForText('body','Hi, I am the Assistant') which works but that is not optimal.

What am I missing?

Joe

Joe
  • 743
  • 5
  • 10
  • 26

1 Answers1

0

As per your HTML shouldn't it be:

And waitForText('.message', 'Hi, I am the Assistant')

I'll be happy to investigate this if your provide a sample following this process: https://github.com/intuit/karate/tree/develop/examples/ui-test

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thank you for replying. I did try that as well and it did not work. – Joe May 22 '20 at 12:50
  • @Joe sorry I'm going to resort to the "it works for me" card. do help us (and the community) fix a potential bug by providing a way to replicate please – Peter Thomas May 22 '20 at 13:50
  • It works with other objects within the main page, just doesn't work when trying to interact with ChatBot on the page. – Joe May 22 '20 at 20:05
  • @Joe, ha - sounds like some shadow dom complexity :) https://stackoverflow.com/a/60618233/143475 – Peter Thomas May 23 '20 at 02:09