From: Ahmed A. <asa...@ya...> - 2016-05-02 12:14:13
|
Hi Helmut, - With SVN version, I don't see NullPointerException. Please update to latest version/build [1].- I get: "Error: Label ID for 'European Union' not found.", because label is an empty string.- You shouldn't set throwsingExceptionOnScriptError to false, otherwise this can hide errors from being reported. - Try to isolate a minimal case as hinted in [2] Ahmed [1] https://ci.canoo.com/teamcity/viewLog.html?buildTypeId=HtmlUnit_FastBuild&buildId=lastSuccessful&tab=artifacts[2] http://htmlunit.sourceforge.net/submittingJSBugs.html From: Helmut Zollner [General] <hj...@al...> To: HTMLunit mailinglist <htm...@li...> Sent: Monday, May 2, 2016 12:13 AM Subject: [Htmlunit-user] HTMLunit fails to execute onclick mojarra script in proforma href - bug report ? Hi, Currently I am writing a kind of web-scraper based on HTMLunit for harvesting company details from the Hannovermesse trade fair website. I seem to have encountered a showstopper in my efforts, because I cannot get the page forward button on the search results page to work in HTMLunit. The entry website is http:/www.hannovermesse.de/en/exhibition/exhibitors-products/advanced-search/ After setting a few Search filters in Checkboxes (EU Region, Industrial Automation/Robotics) it and submitting the form. I am able to load the search results. With the above selection I get around 400 hits, if I select Exhibitors tab. I receive the first results page with the first page. These Search results are displayed on http://www.hannovermesse.de/en/exhibition/exhibitors-products/search . Mojarra jacascripts are used to fill in the data opn the page. NOTE: You need to run the whole sequence to get to the results screen! The host seems to identify the session and thus determines what to display and by default it displays nothing. This gives me first 20 hits on this first page. It also displays on the bottom of the page a page selector, with page 1 selected. "[<][1] 2 ... | n [>]" In order to harvest all contacts I need to click through all the screens indicated in the search results. Until the Right Arrow is no longer an href. The idea was to use the right hand button to iterate through the pages and harvest the company details on each page as I go along. I located the right button with getXPath, verified it. I even modified the DOM Node by adding a Name attribute with the same name as the class attribute so HTMLunit could find it with the more standard HTMLanchor returning functions. This are the details of the right button: [href ] : '#' [onclick ] :'mojarra.jsfcljs(document.getElementById('searchResult:search'),{'searchResult:j_idt489':'searchResult:j_idt489'},'');return false' [class ] : 'button buttonS buttonSecondary next-page icon-arrow-right-desktop ' [name ] : 'button buttonS buttonSecondary next-page icon-arrow-right-desktop' The result was still a runtime error with a NULL pointer Exception. The log messages are: ---------------------------------------------------------------------------------- Mai 01, 2016 6:05:11 PM com.gargoylesoftware.htmlunit.html.HtmlScript isExecutionNeeded WARNING: Script is not JavaScript (type: text/html, language: ). Skipping execution. Mai 01, 2016 6:05:12 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError SEVERE: runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[http://www.hannovermesse.de/files/001-fs5/media/layout/js/dmag.min.js] line=[2] lineSource=[null] lineOffset=[0] Mai 01, 2016 6:05:12 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError SEVERE: runtimeError: message=[An invalid or illegal selector was specified (selector: '[id='sizzle-1462118712173'] :selected' error: Invalid selector: [id="sizzle-1462118712173"] :selected).]sourceName=[http://www.hannovermesse.de/files/001-fs5/media/layout/js/dmag.min.js] line=[2] lineSource=[null] lineOffset=[0] Mai 01, 2016 6:05:12 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Obsolete content type encountered: 'text/javascript'. Mai 01, 2016 6:05:17 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Obsolete content type encountered: 'application/x-javascript'. ---------------------------------------------------------------------------------- Have tried various browser option settings (see setup method), but no joy. I found that this "invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x)."-error has cropped up sometimes with arachnid and another headless browsers. There the insertion of a "webClient().waitForBackgroundJavaScriptStartingBefore(5000);" fixed the issue. I tried that, but it hasn't worked for me. I am enclosing my quick and dirty proof-of-concept Java program for your reference. For a development environment I am using Eclipse MARS (Version: Mars Release (4.5.0) Build id: 20150621-1200) with Java JRE 1.8, JUnit4 and HTMLunit 2.22 libs. Does anyone have an idea what is going on, or what to change to make it work? I can't believe i am the first one to stumble across this! My Java code is attached to this email. Thank you for your ideas or suggestions. Kind Regards Helmut ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |