Comments (3)
What would be the use case for that?
The CDP command types have the to_json()
method to serialize it to be sent to the chrome browser (on-wire format). The JSON structure matches the defined ones by the CDP protocol specification.
The CDP events are just received by the client, they are never sent to the chrome browser (server). That's why there is no to_json()
implemented for them.
from python-cdp.
I understand that, but my use case is a little different. I have a program that uses python-cdp to listen to CDP events, and I want to add functional tests. So, I chose my tests to have as input, CDP events in JSON format, as close as possible to what chrome would give. I don't know a way to access the JSON objects directly, so I chose the following solution: get the CDP events converted to Python objects, as python-cdp does, then convert them back to JSON using the to_json
methods.
from python-cdp.
You want to inject fake CDP events and test your listener behavior? Can't you just inject plain JSON objects and let pycdp parse it?
Instead you can make the function which handles CDP events take them as argument, the Python wrapper types. Then you can call it directly from the test.
Anyway feel free to make a PR, I will review it. Make the to_json()
follow the same syntax and semantic of CDP.
from python-cdp.
Related Issues (7)
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 python-cdp.