Skip to content
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

Capture console.log? #87

Open
tbmreza opened this issue Feb 7, 2022 · 5 comments
Open

Capture console.log? #87

tbmreza opened this issue Feb 7, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@tbmreza
Copy link

tbmreza commented Feb 7, 2022

I found a similar question on stack overflow, using Java client.

LogEntries logs = driver.manage().logs().get(LogType.BROWSER);

https://stackoverflow.com/a/26488661

Maybe a new method that behaves like page_source()? Is this currently possible?

@stevepryde
Copy link
Collaborator

stevepryde commented Feb 9, 2022

Ah, yes I forgot about that one. Looks like that is implemented via a non-W3C command called getLog (url is /session/$sessionId/se/log or /session/$sessionId/se/log/types).

Unfortunately this isn't currently possible in thirtyfour but it could be added.

It could be implemented by adding the command under the Command enum and wiring it up to the SessionHandle struct.
I'm not sure what data/format it wants as input/output. You could probably use trial and error and inspect the data or otherwise read through the Java/python selenium code to find out.

@tbmreza
Copy link
Author

tbmreza commented Feb 9, 2022

Thanks, that's more than enough pointer for me to start exploring! ^^

(To any contributors who come across this issue: I love you so much if you're about to submit a pull request implementing this.)

@stevepryde stevepryde added the enhancement New feature or request label Jul 31, 2022
@AustinHellerRepo
Copy link

Has there been any progress on this front? I'm about to dig into this issue and would like to know if anyone has any feedback/trial-and-error experience.

@tbmreza
Copy link
Author

tbmreza commented Jul 31, 2023

I think I gave up early back then. I can only offer you this link from my bookmarks mozilla/geckodriver#284 (comment) @AustinHellerRepo

@tgrushka
Copy link

Hi @stevepryde , I am brand new to Rust and trying to port all of my NodeJS playwright tests to be run by Rust instead, hopefully with thirtyfour (also looking at chromiumoxide). Is there any way you could give us an example of how to grab the console logs? It seems many of the NodeJS webdriver libraries provide these callbacks, but sadly none of those in Rust seem to have it yet. I really don't know enough about CDP (or Rust for that matter) to help implement, sorry. There must be a CDP command to send and a way to get streaming data, or at minimum, grab a snapshot of the logs/console errors at the end of a test run. Is there any way to use thirtyfour as-is to request the logs, even if the ChromeCommands enum doesn't have it, and get the returned data? Please give us something, as the above link did not help as this Rust crate is very different than the NodeJS examples. I don't care about Firefox, if it doesn't have that ability. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants