-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[🚀 Feature]: Implement high level BiDi script commands #13992
Comments
Related to #13992 Co-authored-by: Titus Fortner <[email protected]>
Hi, are you interested in feedback on the design of this? If so, where, and Is there any kind of design document/plan? (I’m not sure what might be implementation-specific or only partially implemented, other than a vague sense based on the table in this issue.) I’ve been playing a bit with the Ruby implementation as a replacement for some devtools-based code I wrote recently and had some thoughts I hope might be useful. |
@Mr0grog Absolutely, please share your feedback. We don't have the document describing all of this because the API was designed during the in-person DevSummit of Selenium TLC. As we work on implementing these APIs, the feedback is greatly appreciated! |
👍 Great! First off, the That said, one thing I’d love is for console log and javascript error objects from the high-level Barring that, the raw BiDi API’s Background/use case: I’ve been using the devtools API to keep track of what page JS logs and errors are coming from during browser-based tests. This is just generally useful in testing workflows that cover multiple pages or that involve iframes or popups. In my case, an app I recently started working on has tests that include navigations to other sites (e.g. a signup flow that ends by kicking someone over to a marketing page managed by another system at a different subdomain). I use information about the URL to decide whether to ignore JS logs/errors (since we don’t want our tests to fail and prevent a build if the other site is having some issues). Obviously pulling multiple info sources together like I’m suggesting in my ideal scenario adds a lot of complexity to the implementation, but I suspect this info might be useful in a lot of ways whenever automations navigate across multiple pages, perform form submissions, etc. |
I think we should preserve |
@Mr0grog Thanks for the feedback! We're definitely trying to figure this out as we go along. |
Yes, the source bit was added in the web driver BiDi spec relatively recently. I am guessing for the same reason as requested above. We should make everything that is part of types defined in spec https://w3c.github.io/webdriver-bidi/#types-log-logentry, available to the user. |
Oh, I see what you're asking; we just need to update the Struct with source:
That's weird, I would have sworn I added things based on the spec, not sure how I missed source |
Yeah, that is the simplest solution. I guess I thought I’d go ahead and propose something that did more given the description of It would also be nice if the things in the |
Right, the first step is to just expose what's available. I'm a little resistant to adding a bunch of objects for everything in Ruby, but we definitely want to make sure that the output is in a state that is usable in other parts of the code. Maybe the string is what gets passed in as a parameter to another method that provides the tree parsing information. |
👋 Hi, I just wanted to check back in on this — I put up a PR over three months ago (#14236) and talked with @titusfortner on Slack/IRC about it, but never got any feedback. |
Sorry for the delay, it's now merged. Thank you! |
Related to SeleniumHQ#13992 Co-authored-by: Titus Fortner <[email protected]>
Feature and motivation
At the Selenium Dev Summit we agreed on this API to be generally applied across the bindings; we'll keep this labeled beta while we make sure that it works for what is needed
We want the methods to be accessible from a
script()
method available directly from theDriver
class (e.g.,driver.script.pin(script)
,driver.Script().Pin(script)
). We can't do everything just like this in all the languages, because, for example, .NET uses events with a+=
and-=
for adding and removing handler events so we don't went "add" and "remove" methods.Implementations:
pin()
#14250#14305unpin()
#14305#14250execute()
addConsoleMessageHandler()
#14225#14135#14107#14073removeConsoleMessageHandler()
#14225#14135#14107#14073addDomMutationHandler()
#14304#14238removeDomMutationHandler()
#14304#14238addJavaScriptErrorHandler()
#14225#14135#14107#14073removeJavaScriptErrorHandler()
#14225#14135#14107#14073Considerations
driver.log()
was supposed to give access to. As such we agreed it would work well in theScript
implementationThe text was updated successfully, but these errors were encountered: