Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.7.0: isExisting shouldn't raise an error for a nonexistent element #2003

Closed
selenetelenav opened this issue Apr 20, 2017 · 4 comments
Closed
Labels

Comments

@selenetelenav
Copy link

The problem

I use the element.isExisting() method to test whether an element exists without having to catch an error, as described in the docs http://webdriver.io/api/state/isExisting.html .

After updating to Webdriverio v4.7.0, isExisting() raises an error when called on a nonexistent element.

Environment

  • WebdriverIO version: New in 4.7.0. Not present in 4.6.2.
  • Node.js version: v6.2.0
  • wdio testrunner in synchronous mode
  • Additional wdio packages used (if applicable):
    • wdio-dot-reporter@0.0.6
    • wdio-jasmine-framework@0.2.19
    • wdio-junit-reporter@0.1.0
    • wdio-selenium-standalone-service@0.0.6

Details

Sample test

describe('test isExisting', function () {
  it ('should not raise an error for nonexistent element', function () {
    expect(browser.element('#nonexistent').isExisting()).toBeFalsy();
  });
});

Test results on v4.7.0:

F

0 passing (5.00s)
1 failing

1) test isExistingsuite1 should not raise an error for nonexistent element:
Failed: An element could not be located on the page using the given search parameters ("#nonexistent").
running chrome
Error: An element could not be located on the page using the given search parameters ("#nonexistent").
    at isExisting() - at Object.<anonymous> (spec.js:3:44)

Test results on v4.6.2:

․

1 passing (4.60s)

Link to Selenium/WebdriverIO logs

https://gist.github.com/selenetelenav/74ba5f0df9684b0d35fff8f51c56572f

Code To Reproduce Issue [ Good To Have ]

(included in details)

@selenetelenav
Copy link
Author

Looking into this some more, it seems like the issue is actually in browser.element(). In 4.6.2 it did not raise an error for a nonexistent selector, so calling .isExisting() worked. In 4.7.0 it seems to raise an error so .isExisting() never gets called.

@christian-bromann
Copy link
Member

@selenetelenav thanks for reporting. The error lies here. Lemme try to fix this.

@christian-bromann
Copy link
Member

christian-bromann commented Apr 21, 2017

@selenetelenav fixed issue. Publish v4.7.1 if I get a green build

@christian-bromann
Copy link
Member

christian-bromann commented Apr 21, 2017

Fixed and published in v4.7.1. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants