简体   繁体   中英

Selenium Webdriver (Java) - time delay between the scripts

I have one script (test suite) , which run other scripts.

  @RunWith(Suite.class)
    @Suite.SuiteClasses({
            Test002.class,
            Test001.class})

    public class SuiteTest1 {

    }​

I am struggling many times with time out problems to find an object on the page. Even when place Thread.sleep or WebDriverWait. So, is there possibility to put in my main class some delay between scripts?

Something like with Thread.sleep(1000):

@RunWith(Suite.class)
    @Suite.SuiteClasses({
            Test002.class,
            Thread.sleep(1000);
            Test001.class})

You can do it on test level. If you want to make some pauses between test runs, just use method decorated with @BeforeTest where you can place any Thread.sleep(1000) .

In case when you have to use such login in more than one test, use general parent class where you declare the same logic and then you can inherit from it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM