Coder Social home page Coder Social logo

WASM support about thirtyfour HOT 5 OPEN

stevepryde avatar stevepryde commented on July 21, 2024
WASM support

from thirtyfour.

Comments (5)

stevepryde avatar stevepryde commented on July 21, 2024

Honestly I haven't tried compiling to WASM either.
One thing I want to point out is that this library (and likewise fantoccini and other selenium/webdriver libraries) doesn't actually do any browser automation itself. Instead it issues HTTP requests/commands to a webdriver server (chromedriver/geckodriver etc) and it is the webdriver that actually takes care of launching another browser instance and interacting with it. Does that sound like what you're trying to do?

I'm wondering if it isn't easier to simply use javascript/WASM to control the browser you're currently running in, instead.

I guess that's where I'm still a little confused by what you're trying to do. To clarify, are you wanting to do web requests from a browser, to a local webdriver server (or I guess it could be remote if you wish), to then control a separate browser instance?

from thirtyfour.

olanod avatar olanod commented on July 21, 2024

You got it right ;)
I'm aware the webdriver server does the magic and the library is just a client. About the WASM/JS code controlling the current browser, unless I'm missing something one does not "just" control the current browser right? And for some of the stuff that I need to run(e.g. make a screen capture) it won't work to just let the Rust WASM code do things with the current document because this WASM plugin not only doesn't have DOM access(runs in a worker) but also doesn't know if it will be running in a browser or a server. Does it make sense? 😅
Anyway if I have time later enxt week I'll test the WASM compilation, doesn't seem that difficult maybe some parts of the code would need to be feature gated if they are doing things like accessing the file system.

from thirtyfour.

stevepryde avatar stevepryde commented on July 21, 2024

Ok yes that makes sense. Let me know how the WASM compilation goes

from thirtyfour.

TilBlechschmidt avatar TilBlechschmidt commented on July 21, 2024

@olanod you probably have to create a new HTTP request backend. The current default is reqwest which most likely will not even compile to WASM. However, wasm-bindgen or rather js-sys provides access to the native JavaScript APIs for making HTTP requests so it should not be too hard to work around it that way. AFAIK the HTTP client is already abstracted away in thirtyfour 🙂

from thirtyfour.

stevepryde avatar stevepryde commented on July 21, 2024

Yes the http client is abstracted out and you can implement the relevant trait and supply your own.

I'm keen to see how far you get with this.

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.