htmlunit

Load javascript within JFrame or JPanel

寵の児 提交于 2019-12-24 10:25:44
问题 I would like to load a the below javascript code to a JPanel or a JFrame . Is it possible? <script language="javascript" type="text/javascript" charset="utf-8"> //javascript code </script> 回答1: You can use third-party libraries: such as HtmlUnit It has fairly good JavaScript support (which is constantly improving) and is able to work even with quite complex AJAX libraries, simulating either Firefox or Internet Explorer depending on the configuration you want to use. Example: import com

htmlunit always gives multiple javascript exceptions after running the project

天大地大妈咪最大 提交于 2019-12-24 10:11:34
问题 I'm working on a project that checks an email list that is imported to see if the user is registered or not on yahoo. When I click on the Start button, it should go to the yahoo mail sign up page and check every email on this imported txt file. I've relied on htmlunit library but it always gives an exception, despite disabling the JavaScript and ThrowExceptionOnScriptError this the exceptions always happens Exception in thread "AWT-EventQueue-0" ======= EXCEPTION START ======== EcmaError:

Htmlunit null pointer on filling input , but element is not nulled

前提是你 提交于 2019-12-24 09:05:09
问题 So i am trying to automate a login through htmlunit and here are my trials so far , however the output always have null pointer exception , although the element is not nulled public static void main(String[] args) throws IOException, InterruptedException { final WebClient webClient = new WebClient(BrowserVersion.CHROME); final HtmlPage page = webClient.getPage("https://sellercentral.amazon.com"); final HtmlForm form = page.getFormByName("signIn"); final HtmlTextInput un = form.getInputByName(

How to Scrolldwon a web page using htmlunit or PanthomJS

安稳与你 提交于 2019-12-24 08:28:45
问题 I have a web page which continues to loading the contents when ONLY scrolling down the page. So I want a way to scroll down the page pragmatically using HtmlUnit or PanthomJS. Can I imitate the scroll down action(lets think using scroll element). or Can i imitate it using j script. if this can do please explain the way. Thanks. 回答1: You can set InnerHeight a large value. like this: webClient.getCurrentWindow().setInnerHeight(60000); the webcontrol will load all element,because of the

How to Scrolldwon a web page using htmlunit or PanthomJS

坚强是说给别人听的谎言 提交于 2019-12-24 08:28:21
问题 I have a web page which continues to loading the contents when ONLY scrolling down the page. So I want a way to scroll down the page pragmatically using HtmlUnit or PanthomJS. Can I imitate the scroll down action(lets think using scroll element). or Can i imitate it using j script. if this can do please explain the way. Thanks. 回答1: You can set InnerHeight a large value. like this: webClient.getCurrentWindow().setInnerHeight(60000); the webcontrol will load all element,because of the

how to compile code from svn into jar file?

折月煮酒 提交于 2019-12-24 05:35:24
问题 I found HTMLUnit is useful for me,but the files are too old. So I use svn co https://htmlunit.svn.sourceforge.net/svnroot/htmlunit htmlunit to check the code,But I don't know how to use them. Is there somebody can tell me how to compile them? 回答1: I see you have very little knowledge of Subversion. I could link you to lots of verbose documentation, but let's make it quick and easy: what you downloaded is the whole repository , containing lots of redundant code, majorly the three canonical

How to parse a hidden Javascript section from a HTML page

柔情痞子 提交于 2019-12-24 03:22:07
问题 I want to parse the dates+prices of the month September from the hidden calendar on this URL: http://www.lufthansa.com/vol/vol-paris-berlin . The problem here is that when you press on the month September the page will generate the calendar but without changement in the url. I used this code but no result. public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException { WebClient webClient = new WebClient(); HtmlPage myPage = webClient.getPage

XPath _relative_ to given element in HTMLUnit/Groovy?

被刻印的时光 ゝ 提交于 2019-12-23 12:13:18
问题 I would like to evaluate an XPath expression relative to a given element. I have been reading here: http://www.w3schools.com/xpath/default.asp And it seems like one of the syntaxes below should work (esp no leading slash or descendant:) However, none seem to work in HTMLUnit. Any help much appreciated (oh this is a groovy script btw). Thank you! http://htmlunit.sourceforge.net/ http://groovy.codehaus.org/ Misha #!/usr/bin/env groovy import com.gargoylesoftware.htmlunit.WebClient def html="""

calling a JavaScript function with HTMLUnit

本秂侑毒 提交于 2019-12-23 09:00:02
问题 I'm trying to call the function showPage('3'); of this page, for use the page source code after. I tried to do with htmlUnit like so: WebClient webClient = new WebClient(); webClient.waitForBackgroundJavaScriptStartingBefore(10000); HtmlPage page = webClient.getPage("http://www.visittrentino.it/it/cosa_fare/eventi/risultati?minEventDate=09012014&maxEventDate=31012014&tp=searchForm.thismonth&ltp=gennaio"); String javaScriptCode = "showPage('3');"; ScriptResult result = page.executeJavaScript

calling a JavaScript function with HTMLUnit

陌路散爱 提交于 2019-12-23 08:59:17
问题 I'm trying to call the function showPage('3'); of this page, for use the page source code after. I tried to do with htmlUnit like so: WebClient webClient = new WebClient(); webClient.waitForBackgroundJavaScriptStartingBefore(10000); HtmlPage page = webClient.getPage("http://www.visittrentino.it/it/cosa_fare/eventi/risultati?minEventDate=09012014&maxEventDate=31012014&tp=searchForm.thismonth&ltp=gennaio"); String javaScriptCode = "showPage('3');"; ScriptResult result = page.executeJavaScript