Comments (15)
For anyone else looking for CDP support, start here: https://docs.rs/thirtyfour/latest/thirtyfour/extensions/cdp/struct.ChromeDevTools.html
CDP itself is quite large, so we may not have high-level wrappers around it in the short term, but you can implement it yourself without needing to modify thirtyfour.
CDP docs are here: https://chromedevtools.github.io/devtools-protocol/
from thirtyfour.
I don't think this is possible in thirtyfour
currently. Would you be willing to contribute this feature?
from thirtyfour.
Sounds good to me.
from thirtyfour.
I just found this link, which describes the protocol process pretty well: https://github.com/aslushnikov/getting-started-with-cdp
from thirtyfour.
I am not very familiar with chrome driver special protocol, like /session/{session_id}/goog/cdp/execute
, is there any place that I can find it,
from thirtyfour.
Have a look here: https://chromedevtools.github.io/devtools-protocol/
Edit: use the navigation on the side to view docs for each command
from thirtyfour.
You can also check out other selenium libraries such as the python one to see how they do it
from thirtyfour.
It looks like that selenium
open a websocket connection to accept CDP
event, which means we need to introduce a websocket library to thirtyfour
.
Which websocket library would you like to use?
I'm not familiar with this domain, my friends told me tokio-tungstenite is the best chose, but it doesn't support async-std
, and there is a fork to support different async runtime.
from thirtyfour.
Yeah have a look at https://github.com/sdroege/async-tungstenite which supports both runtimes via feature flags
Edit: just realised that's the one you linked to 😂
from thirtyfour.
I thought that most libraries just use a proxy to intercept all those requests :p
from thirtyfour.
You can use a proxy, however you can use CDP to do it, which I would prefer over a proxy since it's coming from the browser itself. It's more like listening to the browser's network tab
from thirtyfour.
Any success on listening the events from a websocket connection? I am trying this with no success yet:
let response = reqwest::get("http://localhost:9222/json/version")
.await?
.json::<HashMap<String, String>>()
.await?;
let ws_debugger_url = response.get("webSocketDebuggerUrl").expect("Couldn't get ws debugger url.");
let (mut socket, _) = connect_async(Url::parse(ws_debugger_url)?).await?;
let dev_tools = ChromeDevTools::new(driver.session());
let version_info = dev_tools.execute_cdp("Browser.getVersion").await?;
println!("{:#?}", version_info);
std::thread::sleep(Duration::from_secs_f64(3.0));
println!("{:#?}", dev_tools.execute_cdp("HeapProfiler.enable").await?);
println!("{:#?}", dev_tools.execute_cdp_with_params("HeapProfiler.takeHeapSnapshot", json!({"reportProgress":true,"treatGlobalObjectsAsRoots":true,"captureNumericValue":false})).await?);
while let Some(Ok(message)) = socket.next().await {
println!("{}", message);
}
from thirtyfour.
Maybe I am missing the session ID or something that binds the websocket to the client sending the requests?
from thirtyfour.
@notdanilo I saw that the OP made a project seperate from thirtyfour, chromiumoxide made for CDP
. To be honest it looks quite similar (but works only for chrome)
EDIT: Yust realized it was a fork from @mattsse
from thirtyfour.
@audioXD I urgently created a CDP client myself because I couldn't get chromiumoxide working. The reason it didnt work was because I was simply misunderstanding how the protocol works and chromiumoxide didn't provide a high level API for what I wanted (getting a memory heap snapshot).
I am still using thirtyfour for collecting information from html although.
from thirtyfour.
Related Issues (20)
- so, how to get the text value of an element HOT 1
- Error while clicking element. HOT 4
- `#shadow-root` doesn't work on Firefox with geckodriver HOT 1
- Connection refused when using containers HOT 4
- How to use selenium-manager in my code? HOT 2
- thread 'tokio-runtime-worker' panicked at 'internal error: entered unreachable code: received unknown error (no such frame) for NOT_FOUND status code' HOT 4
- How can I set the user-agent for Chromedriver? HOT 3
- Is there a way to use wait_until or something like it to way for a specific ID to be available ? HOT 2
- wait until element to disappear HOT 6
- Chrome Options example erroring HOT 2
- Does `query` work on child elements? HOT 3
- Cannot interact with WebElement HOT 1
- How to trigger onchange event without submitting the form? HOT 2
- How to set PageLoadStrategy::None in DesiredCapabilities::chrome()? HOT 1
- Running the Test without Existing Browser (HtmlUnitDriver) HOT 1
- Add cdp type from auto_generate_cdp crate HOT 2
- How to handle file picker? HOT 4
- How to capture the Chromium's requests and responses traffic using thirtyfour HOT 5
- Maintenance Status
- Device Farm incompatibility - with workaround
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 thirtyfour.