Giter Club home page Giter Club logo

Comments (3)

mdmintz avatar mdmintz commented on June 9, 2024 1

If you save cookies using sb.save_cookies("cookies.txt"), you might get a file that looks something like this in ./saved_cookies/cookies.txt:

[{"domain": "www.saucedemo.com", "expiry": 1712082307, "httpOnly": false, "name": "session-username", "path": "/", "sameSite": "Lax", "secure": false, "value": "standard_user"}]

If you run:

sb.open("https://www.saucedemo.com")
sb.load_cookies("cookies.txt")
sb.open("https://www.saucedemo.com/inventory.html")

then you have bypassed the need to login because you already loaded the login cookie.

If you need to need to modify the cookies before loading them, that's just Python file-IO, and that isn't a SeleniumBase-specific question anymore. Lots of resources online, such as on Stack Overflow. However, I may add a method in the next release for getting the cookies from that file without loading them into the browser right away. Could simplify a few things.

from seleniumbase.

mdmintz avatar mdmintz commented on June 9, 2024 1

I added more cookie methods in 4.25.1 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.25.1

from seleniumbase.

LiPingYen avatar LiPingYen commented on June 9, 2024

Hi Michael,

I can't wait for the new feature for adding cookies separately. After some searching, I think my question is about data wrangling not just for cookies and I can solve it by myself.

from seleniumbase.

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.