Comments (3)
The default timeout is 20 seconds and the default interval is 0.5 seconds. These should be reasonable but you can create and set a different default poller by using the WebDriver::set_query_poller() method.
The reason this is better than using implicit waits is because your code now has the option to not wait if you just want to check whether something exists without blocking.
When trying to decide on a reasonable default timeout, consider how long you would normally need to wait for a page to load or an element to show up before you would consider it a bug. This is obviously in the context of testing websites. If you're just automating a website you may have different considerations.
from thirtyfour.
Also note that if the element is found then it will return immediately. The wait / timeout only applies in the case where the element query couldn't find the element.
Have a look through the query interface for more details.
Also if you have an existing element already and want to wait for it to either change an attribute or disappear you can use the element.wait_until() features for that.
from thirtyfour.
Thanks! Yup I'm actually automating a site for use (its an order management system where we process orders) not testing so generally the consideration for an element that's supposed to be there is how long until I'm pretty damn sure there has been an error. For an element that may or may not be there where I need to make a decision based on whether or not it is present, I try to explicit wait on some indicator element that is always there (like a div container the element is in etc) that will let me know the element would be loaded if it were supposed to be, then do a nowait query on the element I'm looking for, otherwise the explicit waits will build up fast. As I'm adding functionality I'm moving away from page objects and toward component objects now so this will likely get built into those. I had to build the MVP in JavaScript with the npm selenium-webdriver but now I'm porting to Rust and pretty pumped to see how much I can clean up this code with your query api, and also just to be in rust again in general.
from thirtyfour.
Related Issues (20)
- so, how to get the text value of an element HOT 1
- Error while clicking element. HOT 4
- `#shadow-root` doesn't work on Firefox with geckodriver HOT 1
- Connection refused when using containers HOT 4
- How to use selenium-manager in my code? HOT 2
- thread 'tokio-runtime-worker' panicked at 'internal error: entered unreachable code: received unknown error (no such frame) for NOT_FOUND status code' HOT 4
- How can I set the user-agent for Chromedriver? HOT 3
- Is there a way to use wait_until or something like it to way for a specific ID to be available ? HOT 2
- wait until element to disappear HOT 6
- Chrome Options example erroring HOT 2
- Does `query` work on child elements? HOT 3
- Cannot interact with WebElement HOT 1
- How to trigger onchange event without submitting the form? HOT 2
- How to set PageLoadStrategy::None in DesiredCapabilities::chrome()? HOT 1
- Running the Test without Existing Browser (HtmlUnitDriver) HOT 1
- Add cdp type from auto_generate_cdp crate HOT 2
- How to handle file picker? HOT 4
- How to capture the Chromium's requests and responses traffic using thirtyfour HOT 5
- Maintenance Status
- Device Farm incompatibility - with workaround
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thirtyfour.