Coder Social home page Coder Social logo

Comments (7)

stevepryde avatar stevepryde commented on July 2, 2024 1

I think TimeoutConfiguration::default() could be used as the default (both internally and also people can use it to infer the defaults later if needed).

As I've said before, the plan with thirtyfour_query was to merge it into thirtyfour and make it a standard feature. It's probably time to make that happen. I'm not sure how to deal with timeouts though. The easiest way is to just set the default implicit wait to 0 and mention it in the docs. This is a breaking change but in my opinion it is a better default because implicit waits are not as convenient (i.e. when verifying that an element doesn't exist). There are also some other changes in the current main branch that are also breaking changes so now is as good a time as any. It probably needs a warning label in the documentation.

from thirtyfour.

stevepryde avatar stevepryde commented on July 2, 2024 1

Regarding removing boilerplate from the thirtyfour_query setup, I've now merged thirtyfour_query into the main branch, so it's available out-of-the-box without any setup. The default implicit wait time is now 0 and the default poller is ElementPoller::TimeoutWithInterval(Duration::from_secs(20), Duration::from_millis(500)) (using ElementPoller::default()). You can set a different poller via WebDriver::set_query_poller()

This means you can now use WebDriver::query(), WebElement::query() and WebElement::wait_until() without any boilerplate setup and it will just work. The traits are also part of the prelude so you don't need to use them specifically.

I suspect the existence of find_element() etc alongside query() may confuse some people though. I'm not really sure how to address that. I may need to make a distinction between lower vs higher level abstractions within WebDriver/WebElement. My preference is to steer people towards the higher-level abstractions but still allow access to the lower-level ones if needed and for those who know what they're doing.

I haven't published v0.25 yet.

from thirtyfour.

zhiburt avatar zhiburt commented on July 2, 2024

By the way it would be also helpful to have some clean method after usage of thirtyfour_query to not have a boilerplate code with a remove of ElementPoller from config and setting default timeouts.

What do you think?

from thirtyfour.

stevepryde avatar stevepryde commented on July 2, 2024

I think I may have misunderstood your later comment. Were you thinking that WebDriverConfig should have a clean() method or similar? or perhaps that method could exist on WebDriver itself?

from thirtyfour.

stevepryde avatar stevepryde commented on July 2, 2024

I've implemented Default for TimeoutConfiguration. I also added a way to clear the WebDriverConfig, but it requires mutable access to WebDriver which may pose a challenge. I don't see this as an urgent thing since in the majority of cases it's better to end the session and create a new browser instance rather than try to keep one session open and reuse it.

However if we want to allow the configuration to be updated at any time, then I would suggest putting the entire WebDriverSession inside a mutex i.e. Arc<Mutex<WebDriverSession>> . That should work ok I think. Actually a RwLock may be better since config writes will be quite rare.

from thirtyfour.

zhiburt avatar zhiburt commented on July 2, 2024

I think I may have misunderstood your later comment.

I was just thinking that things we need to set up to use a thirtyfour_query and to switch to default behavior could be hidden by some functions.

But never mind 😉 don't worry to much about it

from thirtyfour.

zhiburt avatar zhiburt commented on July 2, 2024

looking forward 0.25 :)

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.