Git Product home page Git Product logo

Comments (9)

calebjclark avatar calebjclark commented on June 14, 2024 4

At the very least, it seems we should implement the DOM's set cookie functionality.

from secret-agent.

calebjclark avatar calebjclark commented on June 14, 2024

We currently allow reading cookies but not writing/editing them, however it wouldn't be too difficult to add.

What is your use case for editing cookies?

We hadn't imagined a viable scraping use-case for this, but perhaps we're overlooking something. Let us know... we're open to making this a high priority feature.

from secret-agent.

zedd3v avatar zedd3v commented on June 14, 2024

@calebjclark
Some websites have cookies which are added by doing multiple actions and I want to skip those actions and edit the cookie myself to save memory and time

from secret-agent.

blakebyrnes avatar blakebyrnes commented on June 14, 2024

@zedd3v
Have you seen the UserProfiles function? https://secretagent.dev/docs/advanced/user-profile

We've imagined use cases where you would accumulate cookies as above, and then save off a profile to a file or database.
const profile = await browser.user.exportProfile();

Then when you're ready to resume, you'd create a new Browser with:
const browserWithProfile = await SecretAgent.createBrowser({ userProfile: profile, });

By setting up cookies, dom storage, etc this way, we believe it is significantly harder to detect. If you don't want to "save" the state of your session, you could look at the format of the profile and just recreate a profile with your cookies.

from secret-agent.

zedd3v avatar zedd3v commented on June 14, 2024

@blakebyrnes
I saw that function but that's not what I'm looking for.

The cookies need to be edited programmatically after the website sets them

from secret-agent.

blakebyrnes avatar blakebyrnes commented on June 14, 2024

@zedd3v
Thanks for clarifying. Would you just want to be able to add "set" to the document.cookie api? Or are you "waiting" for the cookies to be set, and want to be able to intercept and change them before they're saved?

from secret-agent.

zedd3v avatar zedd3v commented on June 14, 2024

@blakebyrnes I would just like a set (replace) cookie API.
But the most preferable solution would be to add javascript execution which most of the users (including me) will probably need

from secret-agent.

blakebyrnes avatar blakebyrnes commented on June 14, 2024

We've been hesitant to add the ability to execute arbitrary js code because it opens up things that are hard for us to properly capture in Replay (which is our browser session recording and replay app), and it reintroduces the environment context confusion that puppeteer and playwright have.

Most importantly, it also doesn't emulate what a real user would do, which is our current thinking for how make secret agent the most effective.

Do you have any other examples off the top of your head for things you need (or have needed) for executing raw JavaScript code?

from secret-agent.

zedd3v avatar zedd3v commented on June 14, 2024

Do not have an example currently but I'm sure something will pop up sooner or later.

from secret-agent.

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.