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

isExisting() returns Error if DOM is not present #605

Open
BavithiraG opened this issue Apr 17, 2024 · 2 comments
Open

isExisting() returns Error if DOM is not present #605

BavithiraG opened this issue Apr 17, 2024 · 2 comments
Labels

Comments

@BavithiraG
Copy link

Describe the bug
isExisting() is expected to return false if the DOM is not present. Instead it returns below error
ERR: - Error: No DOM element found using the control selector

To Reproduce
invoke .isExisting() on any element not present

Expected behavior
isExisting() should return false

Logs/Console Output
[browser wdi5] ERR: - Error: No DOM element found using the control selector {"


**Screenshots**
if applicable, add screenshots to help explain your problem.

**Runtime Env (please complete the following information):**

- `wdi5/wdio-ui5-service`-version: 2.0.6
- `UI5` version: 3.9.0
- `wdio`-version (output of `wdio --version`): 8.32.3
- `node`-version (output of `node --version`): v18.14.0

**Additional context**
Add any other context about the problem here,
e.g. any options the target browser is started with like `--headless` or
if the tests run in a CI environment
@BavithiraG BavithiraG changed the title isExisting() returns Error if DOM present isExisting() returns Error if DOM is not present Apr 17, 2024
@vobu
Copy link
Contributor

vobu commented Apr 19, 2024

this is a little hard to grasp as there's no minimal reproducible sample provided, not even sample code.
yet I'm guesstimaiting you're referring to the wdio (not wdi5!) element method .isExisiting()https://webdriver.io/docs/api/element/isExisting
wdi5 sits on top wdio. So if you're doing something along the line
await exists = browser.asControl(selector).$().isExisting(); expect(exists).toBe(false)
this will fail b/c browser.asControl() can't retrieve the DOM element (as it doesn't exist, meh) and subsequent operations on that are not possible.
Instead, please use
await exists = await browser.asControl(selector).isInitialized(); expect exists.toBeFalsy()

Copy link

hey 👋 - silence for 30 days 🤐 ... anybody? 😀

@github-actions github-actions bot added the stale label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants