Giter Site home page Giter Site logo

Pierce iframes about astral HOT 3 OPEN

lino-levan avatar lino-levan commented on August 16, 2024
Pierce iframes

from astral.

Comments (3)

lino-levan avatar lino-levan commented on August 16, 2024

Unfortunately, pierce doesn't work the way you hope it would. This could be something interesting to look into though as a default.

from astral.

liamdiprose avatar liamdiprose commented on August 16, 2024

Thanks for the heads up. I had a look at the Playwright source, but learnt very little. This stack overflow answer helped me though.

Working celestial code:

const doc = await celestial.DOM.getDocument({ depth: 0 })

const frame_node = await celestial.DOM.querySelector({ nodeId: doc.root.nodeId, selector: "iframe#ed-embedded-iframe" })
const frame_description = await celestial.DOM.describeNode({ nodeId: frame_node.nodeId })
const frame_content_remote_object = await celestial.DOM.resolveNode({ backendNodeId: frame_description.node.contentDocument.backendNodeId })
const frame_content_doc = await celestial.DOM.requestNode({ objectId: frame_content_remote_object.object.objectId })

const frame = new ElementHandle(frame_content_doc.nodeId, celestial, page)

await frame.waitForSelector("#ConfirmFee")

Apparently it doesn't work if the iframe's origin is different; security reasons I guess.

It would be a seamless experience if we found a way to query into iframes transparently, but we would have to understand if a query applies to an iframe or not, then modify it to query inside the iframe. It may cause more pain in the long run.

However, if an ElementHandle is on an iframe, then we can forward the querySelector calls to the 'Frame' without too much complexity.

I'd be interested in helping with this project. Are you accepting PRs?

Cheers,
Liam

from astral.

lino-levan avatar lino-levan commented on August 16, 2024

Always happy to accept PRs. I'm curious on how you're thinking about this.

from astral.

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.