question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$.getWrappedElement() should not wait for timeout if element does not exist

See original GitHub issue

the subj method is implemented based on the command:

public class ToWebElement implements Command<WebElement> {
  @Override
  public WebElement execute(SelenideElement proxy, WebElementSource locator, Object[] args) {
    return locator.getWebElement();
  }
}

this command will fail if element does not exist… and will be retried inside “the only one logic of SelenideElementProxy invocation of all commands”:

class SelenideElementProxy implements InvocationHandler {
//...

  @Override
  public Object invoke(Object proxy, Method method, Object... args) throws Throwable {
    if (methodsToSkipLogging.contains(method.getName()))
      return Commands.getInstance().execute(proxy, webElementSource, method.getName(), args);

    validateAssertionMode(config());

    long timeoutMs = getTimeoutMs(method, args);
    long pollingIntervalMs = getPollingIntervalMs(method, args);
    SelenideLog log = SelenideLogger.beginStep(webElementSource.getSearchCriteria(), method.getName(), args);
    try {
      Object result = dispatchAndRetry(timeoutMs, pollingIntervalMs, proxy, method, args);
      SelenideLogger.commitStep(log, PASS);
      return result;
    }
    catch (Error error) {
      Error wrappedError = UIAssertionError.wrap(driver(), error, timeoutMs);
      SelenideLogger.commitStep(log, wrappedError);
      if (config().assertionMode() == SOFT && methodsForSoftAssertion.contains(method.getName()))
        return proxy;
      else
        throw wrappedError;
    }
    catch (RuntimeException error) {
      SelenideLogger.commitStep(log, error);
      throw error;
    }
  }
// ...
}

but it should not… We should have a raw interface to original Selenium WebDriver WebElement without any waiting logic…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
asolntsevcommented, Apr 16, 2020

I suggest that both methods should NOT wait. They are rather synonyms. Otherwise it’s too hard to keep the difference in mind.

I don’t see any reasons why someone would need the “waiting” here.

0reactions
asolntsevcommented, Apr 18, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

java - how to continue the flow when an element is not exists ...
Here you can pass the element locator and the timeout to wait for that element presence. If normally we use 20-30 seconds timeout...
Read more >
SelenideElement (selenide 5.20.4 API) - javadoc.io
IMPORTANT: If element does match the conditions, waits up to 4 seconds until element does not meet the conditions. It's extremely useful for...
Read more >
codeborne/selenide - Gitter
Guys, i try to click on one element but selenide doesn't see it....as soon as i use getWrappedElement() it start clicking? what can...
Read more >
UiElement (WorkFusion API 10.0.0.16) - AWS
Get parent element of this element For example, $("td").parent() could give some "tr". ... Checks that given element does not meet given conditions....
Read more >
Interface SelenideElement
exists(). Checks if element exists true on the current page. SelenideElement ... Wait until given element does NOT meet given condition (with given...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found