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

[readme] Clarify execute_script option #181

Merged
merged 2 commits into from
Feb 24, 2023

Conversation

dtgay
Copy link
Contributor

@dtgay dtgay commented Feb 22, 2023

To protect my reputation, I will not mention how long it took before I realized execute_script is not a boolean option that causes JavaScript to run. Hopefully this PR clarifies the option a bit. Happy to improve the PR if my update is not completely accurate as to what execute_script will accept.

Thanks for your work on Grover! This is a huge improvement over our previous tool.


If you're curious, passing true to execute_script produces an error which can really lead you down a rabbit hole if you mistakenly assume it's a boolean:

/Users/david/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/grover-1.1.4/lib/grover/processor.rb:92:in `call_js_method': Protocol error (Runtime.callFunctionOn): Given expression does not evaluate to a function (Grover::JavaScript::ProtocolError)

To make matters worse, if you add debugging statements to output the function name it's trying to run, the output is screenshot, not true. In retrospect, I understand why this is now, and the problem is obvious. My error was probably built on a number of my own misunderstandings, and on all the context switching I've had to do lately. Hopefully this prevents others from making the same mistake I did!

Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @dtgay 👍 thank you. I've updated your change to also include an example of it's use which should hopefully make it even clearer 😄

@abrom abrom merged commit 786e0aa into Studiosity:main Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants