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.

Get Elements should not raise timeout exception when no elements found. It should return an empty list.

See original GitHub issue

Is your feature request related to a problem? Please describe. Selectors can match multiple targets. Currently Get element just “randomly” returns the first match. This might not be the correct thing. Get Element is used so that further manipulations or validations can be made to that element. Selector might match 0, 1 or N elements.

Describe the solution you’d like Replace Get Element with Get Elements that returns a list of matches. Also have assertion engine there for easy manipulation of that list such as Get Elements selector then value[0]

Describe alternatives you’ve considered Get Element might also raise an error when multiple matches.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
vincenzo-gasparocommented, Sep 12, 2020

Hi, in my opinion Get Elements should allow to return an empty list instead of raising “Could not find element with selector XXX within timeout.” exception, just like SeleniumLibrary

1reaction
mkorpelacommented, Sep 27, 2020

Maybe I just need to set the timeout to 0… 🤪

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Selenium give a timeout exception if an element is ...
So driver will wait for that time and then if driver is not able to find that element on the page, it will...
Read more >
[Question]: null or exception in case if element not found #2063
And I faced strange behavior in case of element not found. When I query element by locator like. await page.QuerySelectorAsync("any locator");.
Read more >
How to continue script when element is not found in selenium
Use findElements instead of findElement . findElements will return an empty list if no matching elements are found instead of an exception.
Read more >
Built-in Exceptions — Python 3.11.1 documentation
This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full”...
Read more >
RPA.Browser library | Robocorp documentation
An absolute path to the created element screenshot is returned. ... text check if alert includes text, will raise ValueError is text does...
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