Hi how we can stop script till an element appears

Hi,

Any one having any idea about how we can stop our script till an element appears, like in case of login after giving email and password i want my script to wait till the home page appears.

I am using Javascript as scripting language and mocha as testing framework.

Thanks,
Pankaj Sharma

use WebDriverWait method.
code:
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(“xpathValue”)));

1 Like

Hi Jagatheskmp,
Above code works fine with java but not with javascript and mocha.

1.Take any element on home page after login say LOGO
2.FindElement of that LOGO and store in List
3.Check count of that List, If count >0 , Stop your script