Code Monkey home page Code Monkey logo

Comments (4)

christian-bromann avatar christian-bromann commented on May 26, 2024 1

I didn't get what exactly you mean, sorry. Do you mean that most of the time there's enough data in ChainablePromiseEvent?

WebdriverIO is able to resolve the chain of promises, so it only matters that you have 1 await at the beginning of the chain like await $('foo').$('bar').$('loo').click(). In this case the bar element is fetched once the foo query is resolved, then the loo element is fetched once the bar element is resolved and the actual click is done once loo is resolved. This has been battle tested and works pretty great even for arrays like await $('foo').$$('bar')[123].$('loo').click().

from webdriverio.

christian-bromann avatar christian-bromann commented on May 26, 2024

Thanks for raising the issue @shadowusr

It is worth to take a look at this again for v9 as it is quite confusing. The biggest drawback of the ChainablePromiseElement is that IDEs autocomplete element chains to things like await (await $('foo')).click(). The reason we have this separation is because we implement the ability to just do await $('foo').$('bar').click() later on and so properties of ChainablePromiseElement are all promises, e.g.

const elem = await $('foo')
console.log(elem.elementId) // returns a string
// while
const elem = $('foo')
console.log(elem.elementId) // returns a Promise<string>

Over time it turned out that it really doesn't matter to have WebdriverIO.Element properties resolved when accessing it. Therefor I suggest to make ChainablePromiseElement the new WebdriverIO.Element.

from webdriverio.

wdio-bot avatar wdio-bot commented on May 26, 2024

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

from webdriverio.

shadowusr avatar shadowusr commented on May 26, 2024

Over time it turned out that it really doesn't matter to have WebdriverIO.Element properties resolved when accessing it.

I didn't get what exactly you mean, sorry. Do you mean that most of the time there's enough data in ChainablePromiseEvent?

I personally think being able to write $().$().click() is very convenient and hope this new solution won't lead to getting rid of it. Because that'd require changing a lot of tests code.

If it's possible to replace WebdriverIO.Element with ChainablePromiseElement while keeping this feature, and use this single type everywhere in commands, that'd be great for sure!

from webdriverio.

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.