-3

I'm writing a script in java using selenium to read the new messages received on web WhatsApp by detecting the new message count red bubble and opening it and reading last x unread messages. I'm able to do that successfully. But what I want that is to call that test every time a new message is received and want it to deploy on the server with a web WhatsApp logged in with a number which remains opened like a website and want to run my script whenever I received a new message.

One way which is working is to call infinitely the Test in AfterTest, which is working fine in my case. But I want to know is there any other way to do that?

1 Answers1

0

You could have one test which loops continuously, checking if you have received any messages. This test could then call the other test.

However, this is not good practice as tests should not rely on other tests, and it would be resource-hogging to have a test continuously executing on a server. It sounds like you are trying to use Selenium to complete tasks rather than to test, which is not its purpose.

to6y
  • 96
  • 1
  • 9