-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Cannot invoke "org.htmlunit.corejs.javascript.Scriptable.getParentScope()" because "obj" is null #151
Comments
Can you please post the whole stacktrace. |
2024-09-13 09:26:58,225 ERROR [main] fugu.web.CrawlerHelper: Failure crawling https://www.twitter.com That last line is where my code begins |
While looking through the output, I also saw this which might be relevant: org.htmlunit.ScriptException: missing ; before statement (injected script#1) I did a quick look through the JavaScript file a few times and didn't notice any semicolon missing, but I also wasn't being meticulous about it. |
Is it possible to share the script or send it by private mail to me? |
Talking with the team now, but this isn't an urgent matter or anything. |
Sent it to the email you listed on your profile. Take your time since it is no rush. Enjoy your vacation 👍 |
Got it, this is really intresting because what you like to achieve is possible in HtmlUnit without injecting js at all (at least from a first look). This will be a great thing to fix... |
Hi everyone!
I am super excited to see there is something compatible with Selenium that I can use to unit test with. My test works as follows:
In the constructor, I initialize a new WebDriver:
Then later on in a different method call, I instruct it to load a static resource. In this case, it is a rendered HTML file from twitter. I then immediately after instruct it to wait for the JavaScript to finish executing by waiting for the root node to finish rendering.
This all works well.
Then even later in the code, I run a JavaScript file that crawls the DOM and adds style attributes to each node. For example:
When HtmlUnit processes this file, I get the exception or error message in the issue title:
I tried to look up the javadoc for ScriptableObject but I get a 404 and so I cannot debug further. Any indication as to what the issue may be? I don't know what "obj" refers to. This code runs in Java Selenium with a ChromeDriver v127, so the JavaScript script should be fine. This only happens on HtmlUnit.
https://www.htmlunit.org/apidocs/org/htmlunit/corejs.javascript.ScriptableObject.html
Any help is appreciated. Thanks!
The text was updated successfully, but these errors were encountered: