Comments (4)
Weird, I had not heard of this command until now. I don't think it is part of the WebDriver spec at all but it seems to use the same W3C protocol to execute the commands.
It shouldn't be too difficult to implement this, going by the python code for it.
from thirtyfour.
Turns out this will require a refactor of some core layers to remove lifetimes from Command
and allow for commands outside the core W3C spec to be passed through. I've started this work on the command-refactor
branch (heads up in case anyone is following this issue).
I'm thinking this might need to be its own function or struct, rather than a method on WebDriver
since it only applies to Chromium-based browsers. It would likely borrow the session and execute the command that way.
from thirtyfour.
@guoyucode I've added initial support for the Chrome Devtools Protocol (CDP) on the cdp
branch.
You can use it as follows:
let caps = DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:4444", &caps).await?;
// Use Chrome Devtools Protocol (CDP).
let dev_tools = ChromeDevTools::new(driver.session());
let mut conditions = NetworkConditions::new();
conditions.download_throughput = 20;
conditions.upload_throughput = 10;
dev_tools.set_network_conditions(&conditions).await?;
let conditions = dev_tools.get_network_conditions().await?;
assert_eq!(conditions.download_throughput, 20);
assert_eq!(conditions.upload_throughput, 10);
println!("Conditions: {:?}", conditions);
// Execute CDP command.
let version_info = dev_tools.execute_cdp("Browser.getVersion").await?;
println!("Chrome Version: {:?}", version_info["product"].as_str());
You can also specify parameters with dev_tools.execute_cdp_with_params()
where the second parameter is a serde_json::Value
containing any arguments you want to supply. This allows sending arbitrary args with any command.
Let me know what you think. I have not tested all of the functionality and probably won't be able to.
from thirtyfour.
This has now been added in v0.20.0
. Please open a new issue if you need anything further.
from thirtyfour.
Related Issues (20)
- 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
- Chromedriver - http incompatibility with hyper HOT 3
- Incompatible with Selenoid
- noProxy should be an Array and not a String
- Get prop `naturalWidth` of img, get a error ` Json("Unexpected value for property: Number(450)")`
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.