1

We have many e2e test written by Selenide. To avoid failing test in test server, I would like selenide to wait for html element appearing.

I know some scripts like wait.until(...) for this. But, I don't want to fix all test code.

Is there any global switch or setting for Selenide ? ( in detail, I hope the option making cssselector waiting )

hiropon
  • 1,675
  • 2
  • 18
  • 41

3 Answers3

0

My question is resolved by this post

Implicit Wait is the way to configure the WebDriver instance to poll the HTML DOM (DOM Tree) 
for a configured amount of time when it tries to find an element 
or find a group/collection of elements if they are not immediately available. 
As per the current W3C specification the default time is configured to 0. 
We can configure the time for the Implicit Wait any where within our script/program and can reconfigure it as per our necessity. 
Once we set Implicit Wait it will be valid for the lifetime of the WebDriver instance.

I think implicit wait time is almost the global switch I expected.

hiropon
  • 1,675
  • 2
  • 18
  • 41
0

Before performing any action, selenide provides methods to look up for Conditions. $("By Locator").shouldBe(Condition."Desired Condition").

0

I might be late for this question. But for anyone who still needs help in selenide wait, my answer might still be helpful.

For selenium if you have wait method like:

element = (new WebDriverWait(driver, <timeOutForElement>))
  .until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(<cssSelector>)));

You can perform the same in Selenide with element = $(<cssSelector>).should(exist);

For

element = (new WebDriverWait(driver, <timeOutForElement>))
  .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(<cssSelector>)));

We just go with element = $(<cssSelector>).shouldBe(visible);

Reference Page Here.

Zichzheng
  • 1,090
  • 7
  • 25