Wait time on app page

I want to wait on the page for 5 min, but appium will get closed after 60 sec could you please tell me what is the solution

If your using java technology than use thread.sleep();:slight_smile:

it didn’t work, please suggst me something

Do some work 5min. E.g. do every 30sec driver.getPagesource().

Please add this:

//Set the timeout command to 10 mins
desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, “600000”)

// YOUR CODE HERE

// Below code help you to wait in 5 mins

    try {
        Thread.sleep(300000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

ok thanks I will try this

Hi,

just to add that capabilitiy newCommandTimeout receives the time in seconds, so instead of 600000 you might want to use 3600 for 1 hour, p.e.

This didn’t work

capabilities.setCapability(“newCommandTimeout”, 360);

driver.manage().timeouts().implicitlyWait(360, TimeUnit.SECONDS);
Assert.assertEquals(CourseDetailsPageObj.verifyStatusMessage(), “Submitted 5 min ago”);

Please use this one to set the capability

desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, “600000”)

As @Telmo_Cardoso comment, you can adjust the number 6000…

300000 this is 5 min right?

1000 is 1sec, so 60000 is 60 sec , than 60000*5=300000 is 5 min right?

1 Like

The time out capability receives time in seconds… so 3600 seconds is 1 hour.

Thread.sleep receives time in milliseconds so 300000 milliseconds is 5 minutes.

You should use:

desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 3600)
...
Thread.sleep(300000);

Off course, you are free to use the times you prefer :slight_smile:

1 Like
        // generate some activity to prevent driver timeout
        for (int i=0; i<10; i++) { //10x30 = 300sec = 5min
            sleep(30);
            try {driver.getPageSource();} catch (Exception e) {}
            System.out.println("   we slept "+(i+1)*30);
        }