How can I get value from JavaScript variable using HTMLUnit
framework? Like I have var important = "Few important words"
and I want to get this string.
|
||||
closed as not a real question by James Montagne, BenM, Andrew, 3nigma, Muhammad Reda Mar 15 '13 at 21:08It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. |
||||
|
If the variable is globall-scoped, I would try using the But if the variable is not globally-scopes, I think you're out of luck:
In that case you may have to rely on screen-scraping or actually parsing the HTML/JavaScript to extract the information. Good luck. See also How do I extract a long string of text from some JavaScript on a web page using BeautifulSoup? - that question is about Python, but the final answer - "use regular expressions" - seems like it could work in Java. Parsing HTML/JavaScript with a RegEx is not the ideal solution, but if you have no other options... |
|||||||||||||||||||||
|