SeleniumHQ / selenium Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add listener for DOM events using CDP and test #8767
Conversation
|
||
await this.executeScript(mutationListener) | ||
|
||
await connection.execute('Page.addScriptToEvaluateOnNewDocument', 4, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the 4
in this line mean. I am guessing it's some form of execution context but can we change this to not be a magic number.
sorry if you have done it this way before but it would be better to have something else for this (even if its context++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a general id that cdp needs, nothing useful as such to us, but yeah, can make it like context++
const cdpConnection = await driver.createCDPConnection('page') | ||
|
||
await driver.logMutationEvents(cdpConnection, function(event) { | ||
console.log(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably assert and not just log the item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AutomatedTester - This is a draft, I tried changing PR to draft, could not find an option, this isnt complete yet, I am working on it with @harsha509
@@ -86,6 +86,8 @@ const WebSocket = require('ws') | |||
const cdp = require('./devtools/CDPConnection') | |||
const remote = require('./remote') | |||
const cdpTargets = ['page', 'browser'] | |||
const fs = require('fs') | |||
let cdpCommandId = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either use uuid, or place the integer on the driver, please don't keep it as a common running number for all connections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cdp API accepts integer
as the value for id
So I have used a random number generator.
@AutomatedTester @corevo @harsha509 - This is ready to be reviewed!! |
Sri Harsha seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Motivation and Context
Types of changes
Checklist