Coder Social home page Coder Social logo

What are the default durations for the WebDriver::Query timeout and polling / What is a reasonable polling time about thirtyfour HOT 3 CLOSED

stevepryde avatar stevepryde commented on June 22, 2024
What are the default durations for the WebDriver::Query timeout and polling / What is a reasonable polling time

from thirtyfour.

Comments (3)

stevepryde avatar stevepryde commented on June 22, 2024 1

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.

stevepryde avatar stevepryde commented on June 22, 2024 1

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.

bcpeinhardt avatar bcpeinhardt commented on June 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.