0

Im making a Selenium automation and I already tried this but no success:

driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

and

TimeUnit.SECONDS.sleep(2);

and

driver.wait(2000);
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
guithepc
  • 19
  • 4
  • Hello i found a Post it may includes the Solution to your problem. [how-do-i-make-a-delay-in-java](https://stackoverflow.com/questions/24104313/how-do-i-make-a-delay-in-java) – Bidi Jul 26 '22 at 09:19
  • Write what error do you get or where exactly the problem is? Maybe attach some method. All these approaches are working, but without context, it is difficult to identify what you exactly need and how we can help you – cheparsky Jul 26 '22 at 18:10

2 Answers2

0

You can use this code:

Code:

System.out.println( "Hello" );

try{
    Thread.sleep( 1000 );
    System.out.println( "sleep 1 second" );
}catch( InterruptedException e ){
    throw new RuntimeException( e );
}

System.out.println( "World" );

Output:

Hello
sleep 1 second
World

Let me know if it helped.

TheSmith1222
  • 345
  • 1
  • 4
  • 11
0

In Katalon you can use:

WebUI.delay(GlobalVariable.DELAY_1_SECONDS)

In Sellenium you can use:

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Or:

WebDriverWait wait = new WebDriverWait(driver,30);

You can find more example in this post of Sadhvi Singh.