How to achieve sychrnoization in automating Android Chat Bot application

Hi,

I am trying to automating an chat bot app which is based on Artificial Intelligence where communication happens using messaging.

Scenario is when you enter a text or keyword (request), bot will send the valid response which is again a text.

My question is I have to wait (explicit) for the bot to send its response to proceed further.
Assuming,Bot should not take more than 30 seconds to send its response,how can handle this scenario.

Thanks in advance.

Hi @arvindkr26,
i do this with approach like:

            startTime = System.currentTimeMillis();
            boolean isFound = false;
            setLookTiming(2);
            do {
                if (!some_Element.isEmpty()) { // we found needed element/text/whatever
                  isFound = true;
                  break;
                }
            } while ((System.currentTimeMillis() - startTime) / 1000) < 30); // wait MAX 30 sec
            setDefaultTiming();

           assertTrue("Bot did not answer in 30 sec", isFound);           

Hi @Aleksei

  1. Is there any alternative way we can achieve using explicit wait WebDriverWait of selenium?
  2. Could you please provide me the Java code for the above mentioned.

Thanks in advance.

  1. there are hundreds of alternatives you may use what ever like or find on web like fluentWait or timeout annotation…
  2. no. i am using what i wrote.

@Aleksei Thanks for the information