Comments (7)
I might play around with it this weekend! Thanks for pointing me to that WebDriver documentation.
from fantoccini.
@jonhoo sorry I never started looking at this! The site I was scraping doubled down on their bot detection and so I pivoted the project 🤷♂️ I might still take a stab at it some time.
from fantoccini.
Sorry it took me a while to get back to this! I think cookie::Cookie
is indeed the way to go 👍
That's awkward about Serialize
. I've found the maintainers of webdriver
pretty receptive to suggestions, so if you suggest it there, it'll probably be implemented pretty quickly! In the meantime though, I think it's okay to add all but one :)
from fantoccini.
Yup, I agree, that would be really handy! But unfortunately all WebDriver supports is to fetch all the cookies of the current document. Maybe that would still be useful to expose though? There are also commands for adding a cookie, and for deleting one. Together, those three may at least get you close to what you want? It should be pretty easy to add support for those to fantoccini if you want to open a PR for me to look at!
from fantoccini.
Yes, please support adding cookies :)
from fantoccini.
@jonhoo I'm working on a PR to add the 5 cookie-related functions as defined in 16. Cookies.
One challenge with defining APIs is in how to pass in/return a cookie. The two options I'm considering are:
1. Accept/return cookies as serde_json::Value
s
Straightforward implementation, just pass everything along to the webdriver
crate and you're done. Users will need to make sure the parameters are of the correct types by checking the spec.
2. Accept/return cookies as a cookie::Cookie
This requires a bit more code within fantoccini
to convert to/from JSON cookies for WebDriver. In particular, WebDriver encodes the Max-Age
of a cookie as a u64 Unix timestamp, whereas cookie::Cookie
requires a Duration
. We'll probably need to pull in a datetime crate like chrono
to be able to resolve this difference.
The two advantages of this approach are that users will be able to:
- More easily (and safely) inspect cookies returned by WebDriver (e.g.,
client.get_named_cookie(&name).await?.value()
) - Construct cookies dynamically via
cookie::CookieBuilder
.
Thoughts?
from fantoccini.
Actually, I hit a bit of a snag while implementing the add_cookie
operation... webdriver::command::AddCookieParameters
does not implement Serialize
, which means that fantoccini
can't serialize the struct to JSON for the POST request :(
I don't actually need add_cookie
, but I'm not sure if it would make sense to add all but one of the supported cookie operations.
from fantoccini.
Related Issues (20)
- WebAuthn support HOT 1
- BrowserStack requires `charset=utf-8` in `Content-Type` header on Selenium >= 4 HOT 1
- 👋 From the Selenium project! HOT 1
- Cannot access error variant information from webdriver::ErrorStatus enum HOT 1
- `Session::with_capabilities_and_connector` hides the WebDriver response HOT 1
- What's happening here? (fantoccini breaks String + &String) HOT 10
- Error when connecting to browserstack: Session not started or terminated HOT 1
- Test whether text is visible? HOT 3
- excute() doesnt execute some scripts correctly HOT 3
- SessionNotCreated error on second run with fantoccini and geckodriver HOT 1
- How to specify options for webdriver? HOT 1
- An error occurs in the IE mode of the Edge browser. HOT 2
- Testing of client&server-side Rust interaction HOT 1
- returning Prototype.Array shows in console.log but nothing from println. HOT 1
- Can you automate the geckodriver session initialization? HOT 2
- Please add Network Request Interception HOT 1
- Get console log messages HOT 1
- webdriver might be part of public API HOT 1
- WheelActions needed HOT 2
- Any blockers for 0.20? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fantoccini.