You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(17) |
Aug
(18) |
Sep
(22) |
Oct
(16) |
Nov
(6) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(11) |
Feb
(10) |
Mar
(34) |
Apr
(26) |
May
(6) |
Jun
(22) |
Jul
(14) |
Aug
(4) |
Sep
(47) |
Oct
(69) |
Nov
(23) |
Dec
(21) |
2005 |
Jan
(53) |
Feb
(33) |
Mar
(92) |
Apr
(65) |
May
(63) |
Jun
(57) |
Jul
(43) |
Aug
(132) |
Sep
(61) |
Oct
(75) |
Nov
(60) |
Dec
(130) |
2006 |
Jan
(74) |
Feb
(87) |
Mar
(101) |
Apr
(58) |
May
(54) |
Jun
(42) |
Jul
(31) |
Aug
(67) |
Sep
(61) |
Oct
(71) |
Nov
(28) |
Dec
(58) |
2007 |
Jan
(53) |
Feb
(50) |
Mar
(96) |
Apr
(66) |
May
(55) |
Jun
(130) |
Jul
(99) |
Aug
(115) |
Sep
(37) |
Oct
(78) |
Nov
(24) |
Dec
(70) |
2008 |
Jan
(94) |
Feb
(85) |
Mar
(197) |
Apr
(274) |
May
(119) |
Jun
(143) |
Jul
(193) |
Aug
(99) |
Sep
(160) |
Oct
(120) |
Nov
(178) |
Dec
(109) |
2009 |
Jan
(238) |
Feb
(169) |
Mar
(115) |
Apr
(109) |
May
(131) |
Jun
(167) |
Jul
(144) |
Aug
(193) |
Sep
(155) |
Oct
(154) |
Nov
(97) |
Dec
(127) |
2010 |
Jan
(108) |
Feb
(127) |
Mar
(176) |
Apr
(113) |
May
(130) |
Jun
(200) |
Jul
(115) |
Aug
(80) |
Sep
(92) |
Oct
(101) |
Nov
(124) |
Dec
(53) |
2011 |
Jan
(67) |
Feb
(144) |
Mar
(88) |
Apr
(60) |
May
(89) |
Jun
(54) |
Jul
(68) |
Aug
(81) |
Sep
(48) |
Oct
(40) |
Nov
(10) |
Dec
(20) |
2012 |
Jan
(21) |
Feb
(28) |
Mar
(17) |
Apr
(35) |
May
(41) |
Jun
(44) |
Jul
(68) |
Aug
(67) |
Sep
(89) |
Oct
(58) |
Nov
(47) |
Dec
(56) |
2013 |
Jan
(49) |
Feb
(28) |
Mar
(46) |
Apr
(31) |
May
(28) |
Jun
(37) |
Jul
(34) |
Aug
(52) |
Sep
(42) |
Oct
(108) |
Nov
(59) |
Dec
(56) |
2014 |
Jan
(41) |
Feb
(72) |
Mar
(46) |
Apr
(21) |
May
(19) |
Jun
(17) |
Jul
(15) |
Aug
(40) |
Sep
(11) |
Oct
(3) |
Nov
(5) |
Dec
(31) |
2015 |
Jan
(11) |
Feb
(12) |
Mar
(19) |
Apr
(19) |
May
(38) |
Jun
(54) |
Jul
(14) |
Aug
(42) |
Sep
(14) |
Oct
(16) |
Nov
(26) |
Dec
(14) |
2016 |
Jan
(3) |
Feb
(1) |
Mar
(24) |
Apr
(5) |
May
(15) |
Jun
(14) |
Jul
(33) |
Aug
(19) |
Sep
(8) |
Oct
(10) |
Nov
|
Dec
(2) |
2017 |
Jan
(16) |
Feb
(12) |
Mar
(23) |
Apr
(8) |
May
(11) |
Jun
(20) |
Jul
(21) |
Aug
(20) |
Sep
|
Oct
(6) |
Nov
(9) |
Dec
(2) |
2018 |
Jan
(7) |
Feb
(5) |
Mar
(6) |
Apr
(5) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
|
Dec
(4) |
2019 |
Jan
(2) |
Feb
(2) |
Mar
(3) |
Apr
(4) |
May
|
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(7) |
2020 |
Jan
(2) |
Feb
(6) |
Mar
(9) |
Apr
(1) |
May
(1) |
Jun
(15) |
Jul
(1) |
Aug
(1) |
Sep
(2) |
Oct
(6) |
Nov
(3) |
Dec
(5) |
2021 |
Jan
(3) |
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: asashour <asa...@ya...> - 2015-05-25 16:01:10
|
Hi, This is classpath issue. Please remove all your currently used JARs and use instead all the .jars inside the 'lib' folder of "htmlunit-2.17-SNAPSHOT-bin.zip" Ahmed -- View this message in context: http://htmlunit.10904.n7.nabble.com/HtmlUnit-does-not-execute-code-library-ocrad-js-tp36167p36191.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: rogal180 <rog...@gm...> - 2015-05-25 15:07:51
|
Hi, Now is this: I downloaded and changed to version 17, but this time with the line: is thrown exception: this is just the game that I gave above. Regards, Lukasz -- View this message in context: http://htmlunit.10904.n7.nabble.com/HtmlUnit-does-not-execute-code-library-ocrad-js-tp36167p36187.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-25 08:12:23
|
Hi, As hinted in HtmlUnit home page, you can get it from https://ci.canoo.com/teamcity/viewLog.html?buildTypeId=HtmlUnit_FastBuild&buildId=lastSuccessful&tab=artifacts (login as guest) Ahmed From: rogal180 <rog...@gm...> To: htm...@li... Sent: Sunday, May 24, 2015 11:31 PM Subject: Re: [Htmlunit-user] HtmlUnit does not execute code library ocrad.js Hi, Thank you for your response, You can write me how can I download the latest snapshot as a guest? Regards -- View this message in context: http://htmlunit.10904.n7.nabble.com/HtmlUnit-does-not-execute-code-library-ocrad-js-tp36167p36179.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: rogal180 <rog...@gm...> - 2015-05-24 21:50:35
|
Hi, Thank you for your response, You can write me how can I download the latest snapshot as a guest? Regards -- View this message in context: http://htmlunit.10904.n7.nabble.com/HtmlUnit-does-not-execute-code-library-ocrad-js-tp36167p36179.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-24 20:56:22
|
Hi Rogal, With some fixes, SVN version now gets the error: Caused by: com.gargoylesoftware.htmlunit.ScriptException: 5264280 - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch. (http://hostname/ocrad.js#1306) Can you provide a compiled version with that option? You can get the latest snapshot once after a green build in https://ci.canoo.com/teamcity/project.html?projectId=HtmlUnit You can help investigate by looking into http://htmlunit.sourceforge.net/submittingJSBugs.html Ahmed From: rogal180 <rog...@gm...> To: htm...@li... Sent: Saturday, May 23, 2015 9:39 PM Subject: Re: [Htmlunit-user] HtmlUnit does not execute code library ocrad.js Hi OK, i changed to version 2.16 and this time gets the error: Edit 1: if I add the java code something like this: then exceptions disappear, but gives me: I mean, that does not set properly tag. If I open a file aaa.html manually in the browser, it orzymuje the contents of this tag. I would ask for help, how can I solve this problem / go around |
From: rogal180 <rog...@gm...> - 2015-05-23 19:59:04
|
Hi OK, i changed to version 2.16 and this time gets the error: Edit 1: if I add the java code something like this: then exceptions disappear, but gives me: I mean, that does not set properly tag. If I open a file aaa.html manually in the browser, it orzymuje the contents of this tag. I would ask for help, how can I solve this problem / go around -- View this message in context: http://htmlunit.10904.n7.nabble.com/HtmlUnit-does-not-execute-code-library-ocrad-js-tp36167p36172.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: asashour <asa...@ya...> - 2015-05-23 18:38:43
|
Hi, You must subscribe to the list before posting. Please retest with latest version, and provide the output. Ahmed -- View this message in context: http://htmlunit.10904.n7.nabble.com/HtmlUnit-does-not-execute-code-library-ocrad-js-tp36167p36169.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-23 07:42:56
|
Hi Roberto, The build failed, and so it wasn't updated. Now it is green, and the artifacts are built. Please try again. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Friday, May 22, 2015 12:48 PM Subject: Re: [Htmlunit-user] Browser back button Hi Ahmed.. i changed my code, overwriting your code.. but..now this System.out.println("Text Source AFTER : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); displays a black page.. Thanks Roberto. ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Friday, May 22, 2015 10:40 AM Subject: Re: [Htmlunit-user] Browser back button Hi Roberto, This was just fixed. Please get SVN or latest snapshot from the build server once the queued build is green (https://ci.canoo.com/teamcity/viewType.html?buildTypeId=HtmlUnit_QuickBuild) Also, please note you need to update the page, namely: System.out.println("Text Source BEFORE : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); Thanks, Ahmed From: Ahmed Ashour <asa...@ya...> To: "htm...@li..." <htm...@li...> Sent: Thursday, May 21, 2015 2:25 PM Subject: Re: [Htmlunit-user] Browser back button Hi Roberto, This is because history currently handles only GET requests, not POST. Please open a bug ticket. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 11:02 AM Subject: Re: [Htmlunit-user] Browser back button Hi, this is my code .. the code (doUASC() ) try to get some data from a page : browser.getPage("http://uasconline.uasc.net/Home"); and then do a "back page" : System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); follows the full code . Thanks! Roberto package uasc; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.*; import com.gargoylesoftware.htmlunit.WebAssert.*; import com.gargoylesoftware.htmlunit.RefreshHandler; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.CookieManager; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.History; import com.gargoylesoftware.htmlunit.ScriptResult; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDivElement; import com.gargoylesoftware.htmlunit.javascript.host.Event; import com.gargoylesoftware.htmlunit.javascript.background.*; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.HttpMethod; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.io.IOException; import java.net.URL; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.*; import java.text.*; import java.net.URL; import java.util.LinkedList; import java.util.List; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowEvent; import com.gargoylesoftware.htmlunit.WebWindowListener; import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class UASC { static final WebClient browser; static final LinkedList<WebWindow> windows = new LinkedList<WebWindow>(); static { browser = new WebClient(BrowserVersion.FIREFOX_24); browser.getOptions().setJavaScriptEnabled(true); browser.setAjaxController(new NicelyResynchronizingAjaxController()); CookieManager cookieMan = new CookieManager(); cookieMan = browser.getCookieManager(); cookieMan.setCookiesEnabled(true); browser.getOptions().setRedirectEnabled(true); browser.getOptions().setThrowExceptionOnFailingStatusCode(false); browser.getOptions().setPrintContentOnFailingStatusCode(true); browser.getOptions().setThrowExceptionOnScriptError(false); //browser.getOptions().isPopupBlockerEnabled(); browser.addWebWindowListener(new WebWindowListener() { public void webWindowClosed(WebWindowEvent event) { System.out.println("---------------------------------------------- a window is CLOSED: " + event.getOldPage()); } public void webWindowContentChanged(WebWindowEvent event) { System.out.println("---------------------------------------------- webWindowContentChanged: "); } public void webWindowOpened(WebWindowEvent event) { System.out.println("---------------------------------------------- a NEW window opened: " + event.getNewPage()); windows.add(event.getWebWindow()); } }); } public static void main(String[] args) { doUASC(); } private static void doUASC() { try { // ------------------------------------------------------------------ search form HtmlPage page = (HtmlPage) browser.getPage("http://uasconline.uasc.net/Home"); String xpath = "//input[contains(@id, 'trackText')]"; HtmlTextInput searchTerm = (HtmlTextInput) page.getByXPath(xpath).get(0); xpath = "//a[contains(@onclick, 'subOnlineTrack()')]"; HtmlAnchor anchor = (HtmlAnchor) page.getByXPath(xpath).get(0); searchTerm.setText("CNQIN141696"); // booking number page = (HtmlPage) anchor.click(); List<HtmlElement> aEs = new ArrayList<HtmlElement>(); xpath = "//table[contains(@id, 'table-trackSummary')]"; HtmlTable table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor) { String cont_number = StringUtils.remove(row.getCell(2).asText(), " "); if (checkContainerNumber(cont_number)) { aEs.add(cont_anchor); break; } } } Iterator aeit = aEs.iterator(); while (aeit.hasNext()) { HtmlElement aE = (HtmlElement) aeit.next(); try { xpath = "//table[contains(@id, 'table-trackSummary')]"; table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor && StringUtils.containsIgnoreCase(aE.getTextContent(), cont_anchor.getTextContent())) { page = cont_anchor.click(); xpath = "//table[contains(@id, 'table-trackContainer')]"; List<HtmlTable> det_tables = (List<HtmlTable>) page.getByXPath(xpath); // do something... System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); break; } } } catch (Exception e) { System.out.println(e.toString()); } } if (true) { browser.closeAllWindows(); return; } } catch (Exception e) { System.out.println(e.toString()); } } private static boolean checkContainerNumber(String txt) { boolean match = false; if (!StringUtils.isEmpty(StringUtils.trim(txt))) { //String txt="abcd1234567"; String re1 = "((?:[a-z][a-z]+))"; // Word 1 String re2 = "(\\d+)"; // Integer Number 1 Pattern p = Pattern.compile(re1 + re2, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher m = p.matcher(txt); match = m.find(); } return match; } } ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 9:49 AM Subject: Re: [Htmlunit-user] Browser back button Hi, Then please post your complete case. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 9:45 AM Subject: Re: [Htmlunit-user] Browser back button Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: Roberto B. - A. <r.b...@af...> - 2015-05-22 10:48:12
|
Hi Ahmed.. i changed my code, overwriting your code.. but..now this System.out.println("Text Source AFTER : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); displays a black page.. Thanks Roberto. ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Friday, May 22, 2015 10:40 AM Subject: Re: [Htmlunit-user] Browser back button Hi Roberto, This was just fixed. Please get SVN or latest snapshot from the build server once the queued build is green (https://ci.canoo.com/teamcity/viewType.html?buildTypeId=HtmlUnit_QuickBuild) Also, please note you need to update the page, namely: System.out.println("Text Source BEFORE : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); Thanks, Ahmed From: Ahmed Ashour <asa...@ya...> To: "htm...@li..." <htm...@li...> Sent: Thursday, May 21, 2015 2:25 PM Subject: Re: [Htmlunit-user] Browser back button Hi Roberto, This is because history currently handles only GET requests, not POST. Please open a bug ticket. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 11:02 AM Subject: Re: [Htmlunit-user] Browser back button Hi, this is my code .. the code (doUASC() ) try to get some data from a page : browser.getPage("http://uasconline.uasc.net/Home"); and then do a "back page" : System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); follows the full code . Thanks! Roberto package uasc; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.*; import com.gargoylesoftware.htmlunit.WebAssert.*; import com.gargoylesoftware.htmlunit.RefreshHandler; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.CookieManager; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.History; import com.gargoylesoftware.htmlunit.ScriptResult; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDivElement; import com.gargoylesoftware.htmlunit.javascript.host.Event; import com.gargoylesoftware.htmlunit.javascript.background.*; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.HttpMethod; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.io.IOException; import java.net.URL; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.*; import java.text.*; import java.net.URL; import java.util.LinkedList; import java.util.List; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowEvent; import com.gargoylesoftware.htmlunit.WebWindowListener; import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class UASC { static final WebClient browser; static final LinkedList<WebWindow> windows = new LinkedList<WebWindow>(); static { browser = new WebClient(BrowserVersion.FIREFOX_24); browser.getOptions().setJavaScriptEnabled(true); browser.setAjaxController(new NicelyResynchronizingAjaxController()); CookieManager cookieMan = new CookieManager(); cookieMan = browser.getCookieManager(); cookieMan.setCookiesEnabled(true); browser.getOptions().setRedirectEnabled(true); browser.getOptions().setThrowExceptionOnFailingStatusCode(false); browser.getOptions().setPrintContentOnFailingStatusCode(true); browser.getOptions().setThrowExceptionOnScriptError(false); //browser.getOptions().isPopupBlockerEnabled(); browser.addWebWindowListener(new WebWindowListener() { public void webWindowClosed(WebWindowEvent event) { System.out.println("---------------------------------------------- a window is CLOSED: " + event.getOldPage()); } public void webWindowContentChanged(WebWindowEvent event) { System.out.println("---------------------------------------------- webWindowContentChanged: "); } public void webWindowOpened(WebWindowEvent event) { System.out.println("---------------------------------------------- a NEW window opened: " + event.getNewPage()); windows.add(event.getWebWindow()); } }); } public static void main(String[] args) { doUASC(); } private static void doUASC() { try { // ------------------------------------------------------------------ search form HtmlPage page = (HtmlPage) browser.getPage("http://uasconline.uasc.net/Home"); String xpath = "//input[contains(@id, 'trackText')]"; HtmlTextInput searchTerm = (HtmlTextInput) page.getByXPath(xpath).get(0); xpath = "//a[contains(@onclick, 'subOnlineTrack()')]"; HtmlAnchor anchor = (HtmlAnchor) page.getByXPath(xpath).get(0); searchTerm.setText("CNQIN141696"); // booking number page = (HtmlPage) anchor.click(); List<HtmlElement> aEs = new ArrayList<HtmlElement>(); xpath = "//table[contains(@id, 'table-trackSummary')]"; HtmlTable table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor) { String cont_number = StringUtils.remove(row.getCell(2).asText(), " "); if (checkContainerNumber(cont_number)) { aEs.add(cont_anchor); break; } } } Iterator aeit = aEs.iterator(); while (aeit.hasNext()) { HtmlElement aE = (HtmlElement) aeit.next(); try { xpath = "//table[contains(@id, 'table-trackSummary')]"; table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor && StringUtils.containsIgnoreCase(aE.getTextContent(), cont_anchor.getTextContent())) { page = cont_anchor.click(); xpath = "//table[contains(@id, 'table-trackContainer')]"; List<HtmlTable> det_tables = (List<HtmlTable>) page.getByXPath(xpath); // do something... System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); break; } } } catch (Exception e) { System.out.println(e.toString()); } } if (true) { browser.closeAllWindows(); return; } } catch (Exception e) { System.out.println(e.toString()); } } private static boolean checkContainerNumber(String txt) { boolean match = false; if (!StringUtils.isEmpty(StringUtils.trim(txt))) { //String txt="abcd1234567"; String re1 = "((?:[a-z][a-z]+))"; // Word 1 String re2 = "(\\d+)"; // Integer Number 1 Pattern p = Pattern.compile(re1 + re2, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher m = p.matcher(txt); match = m.find(); } return match; } } ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 9:49 AM Subject: Re: [Htmlunit-user] Browser back button Hi, Then please post your complete case. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 9:45 AM Subject: Re: [Htmlunit-user] Browser back button Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: Ahmed A. <asa...@ya...> - 2015-05-22 08:43:52
|
Hi Roberto, This was just fixed. Please get SVN or latest snapshot from the build server once the queued build is green (https://ci.canoo.com/teamcity/viewType.html?buildTypeId=HtmlUnit_QuickBuild) Also, please note you need to update the page, namely: System.out.println("Text Source BEFORE : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + ((HtmlPage) browser.getWebWindows().get(0).getEnclosedPage()).asText() + "\n"); Thanks,Ahmed From: Ahmed Ashour <asa...@ya...> To: "htm...@li..." <htm...@li...> Sent: Thursday, May 21, 2015 2:25 PM Subject: Re: [Htmlunit-user] Browser back button Hi Roberto, This is because history currently handles only GET requests, not POST. Please open a bug ticket. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 11:02 AM Subject: Re: [Htmlunit-user] Browser back button Hi, this is my code .. the code (doUASC() ) try to get some data from a page : browser.getPage("http://uasconline.uasc.net/Home"); and then do a "back page" : System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); follows the full code . Thanks! Roberto package uasc; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.*; import com.gargoylesoftware.htmlunit.WebAssert.*; import com.gargoylesoftware.htmlunit.RefreshHandler; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.CookieManager; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.History; import com.gargoylesoftware.htmlunit.ScriptResult; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDivElement; import com.gargoylesoftware.htmlunit.javascript.host.Event; import com.gargoylesoftware.htmlunit.javascript.background.*; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.HttpMethod; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.io.IOException; import java.net.URL; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.*; import java.text.*; import java.net.URL; import java.util.LinkedList; import java.util.List; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowEvent; import com.gargoylesoftware.htmlunit.WebWindowListener; import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class UASC { static final WebClient browser; static final LinkedList<WebWindow> windows = new LinkedList<WebWindow>(); static { browser = new WebClient(BrowserVersion.FIREFOX_24); browser.getOptions().setJavaScriptEnabled(true); browser.setAjaxController(new NicelyResynchronizingAjaxController()); CookieManager cookieMan = new CookieManager(); cookieMan = browser.getCookieManager(); cookieMan.setCookiesEnabled(true); browser.getOptions().setRedirectEnabled(true); browser.getOptions().setThrowExceptionOnFailingStatusCode(false); browser.getOptions().setPrintContentOnFailingStatusCode(true); browser.getOptions().setThrowExceptionOnScriptError(false); //browser.getOptions().isPopupBlockerEnabled(); browser.addWebWindowListener(new WebWindowListener() { public void webWindowClosed(WebWindowEvent event) { System.out.println("---------------------------------------------- a window is CLOSED: " + event.getOldPage()); } public void webWindowContentChanged(WebWindowEvent event) { System.out.println("---------------------------------------------- webWindowContentChanged: "); } public void webWindowOpened(WebWindowEvent event) { System.out.println("---------------------------------------------- a NEW window opened: " + event.getNewPage()); windows.add(event.getWebWindow()); } }); } public static void main(String[] args) { doUASC(); } private static void doUASC() { try { // ------------------------------------------------------------------ search form HtmlPage page = (HtmlPage) browser.getPage("http://uasconline.uasc.net/Home"); String xpath = "//input[contains(@id, 'trackText')]"; HtmlTextInput searchTerm = (HtmlTextInput) page.getByXPath(xpath).get(0); xpath = "//a[contains(@onclick, 'subOnlineTrack()')]"; HtmlAnchor anchor = (HtmlAnchor) page.getByXPath(xpath).get(0); searchTerm.setText("CNQIN141696"); // booking number page = (HtmlPage) anchor.click(); List<HtmlElement> aEs = new ArrayList<HtmlElement>(); xpath = "//table[contains(@id, 'table-trackSummary')]"; HtmlTable table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor) { String cont_number = StringUtils.remove(row.getCell(2).asText(), " "); if (checkContainerNumber(cont_number)) { aEs.add(cont_anchor); break; } } } Iterator aeit = aEs.iterator(); while (aeit.hasNext()) { HtmlElement aE = (HtmlElement) aeit.next(); try { xpath = "//table[contains(@id, 'table-trackSummary')]"; table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor && StringUtils.containsIgnoreCase(aE.getTextContent(), cont_anchor.getTextContent())) { page = cont_anchor.click(); xpath = "//table[contains(@id, 'table-trackContainer')]"; List<HtmlTable> det_tables = (List<HtmlTable>) page.getByXPath(xpath); // do something... System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); break; } } } catch (Exception e) { System.out.println(e.toString()); } } if (true) { browser.closeAllWindows(); return; } } catch (Exception e) { System.out.println(e.toString()); } } private static boolean checkContainerNumber(String txt) { boolean match = false; if (!StringUtils.isEmpty(StringUtils.trim(txt))) { //String txt="abcd1234567"; String re1 = "((?:[a-z][a-z]+))"; // Word 1 String re2 = "(\\d+)"; // Integer Number 1 Pattern p = Pattern.compile(re1 + re2, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher m = p.matcher(txt); match = m.find(); } return match; } } ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 9:49 AM Subject: Re: [Htmlunit-user] Browser back button Hi, Then please post your complete case. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 9:45 AM Subject: Re: [Htmlunit-user] Browser back button Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: asashour <asa...@ya...> - 2015-05-22 06:54:58
|
It seems the content needs scrolling down. Trying with productPage.getBody().type(KeyboardEvent.DOM_VK_PAGE_DOWN); doesn't work. You need to know which triggers the javascript to fill the data. Some hints in http://htmlunit.sourceforge.net/submittingJSBugs.html Ahmed -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-lazyload-page-with-htmlunit-tp36142p36151.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: adam <sh...@qq...> - 2015-05-22 03:24:05
|
asashour,thanks very much~ i've change my code,but it doesn't work. WebClient webClient = new WebClient(BrowserVersion.CHROME); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(true); webClient.setJavaScriptTimeout(99999); webClient.waitForBackgroundJavaScript(99999); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); try { HtmlPage productPage = (HtmlPage)webClient.getPage("http://detail.1688.com/offer/1228752603.html"); HtmlElement dealElement = (HtmlElement) productPage.getFirstByXPath("//*[@id=\"mod-detail-otabs\"]/ul/li[2]/a/span"); HtmlElement commentElement = (HtmlElement) productPage.getFirstByXPath("//*[@id=\"commentbody\"]/dl[1]/dd/div[2]"); if(dealElement!=null) { System.out.println(dealElement.asXml()); } if(commentElement!=null) { System.out.println(commentElement.asXml()); } System.out.println(productPage.asText()); } dealElement and commentElement return null; -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-lazyload-page-with-htmlunit-tp36142p36150.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-21 14:52:10
|
Hi Adam, Please try simulating CHROME. Ahmed From: adam <sh...@qq...> To: htm...@li... Sent: Thursday, May 21, 2015 2:23 PM Subject: [Htmlunit-user] How to handle lazyload page with htmlunit i can't access lazyload part.i am nearly crazy. below is my code: WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_11); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(true); webClient.setJavaScriptTimeout(99999); webClient.waitForBackgroundJavaScript(99999); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); HtmlPage productPage = (HtmlPage) webClient.getPage("http://detail.1688.com/offer/1228752603.html"); |
From: Ahmed A. <asa...@ya...> - 2015-05-21 14:52:04
|
Hi Adam, Please try simulating CHROME. Ahmed From: adam <sh...@qq...> To: htm...@li... Sent: Thursday, May 21, 2015 2:23 PM Subject: [Htmlunit-user] How to handle lazyload page with htmlunit i can't access lazyload part.i am nearly crazy. below is my code: WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_11); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(true); webClient.setJavaScriptTimeout(99999); webClient.waitForBackgroundJavaScript(99999); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); HtmlPage productPage = (HtmlPage) webClient.getPage("http://detail.1688.com/offer/1228752603.html"); |
From: adam <sh...@qq...> - 2015-05-21 12:42:56
|
i can't access lazyload part.i am nearly crazy. below is my code: WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_11); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(true); webClient.setJavaScriptTimeout(99999); webClient.waitForBackgroundJavaScript(99999); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); HtmlPage productPage = (HtmlPage) webClient.getPage("http://detail.1688.com/offer/1228752603.html"); -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-lazyload-page-with-htmlunit-tp36142.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-21 12:28:51
|
Hi Roberto, This is because history currently handles only GET requests, not POST. Please open a bug ticket. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 11:02 AM Subject: Re: [Htmlunit-user] Browser back button Hi, this is my code .. the code (doUASC() ) try to get some data from a page : browser.getPage("http://uasconline.uasc.net/Home"); and then do a "back page" : System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); follows the full code . Thanks! Roberto package uasc; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.*; import com.gargoylesoftware.htmlunit.WebAssert.*; import com.gargoylesoftware.htmlunit.RefreshHandler; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.CookieManager; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.History; import com.gargoylesoftware.htmlunit.ScriptResult; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDivElement; import com.gargoylesoftware.htmlunit.javascript.host.Event; import com.gargoylesoftware.htmlunit.javascript.background.*; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.HttpMethod; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.io.IOException; import java.net.URL; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.*; import java.text.*; import java.net.URL; import java.util.LinkedList; import java.util.List; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowEvent; import com.gargoylesoftware.htmlunit.WebWindowListener; import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class UASC { static final WebClient browser; static final LinkedList<WebWindow> windows = new LinkedList<WebWindow>(); static { browser = new WebClient(BrowserVersion.FIREFOX_24); browser.getOptions().setJavaScriptEnabled(true); browser.setAjaxController(new NicelyResynchronizingAjaxController()); CookieManager cookieMan = new CookieManager(); cookieMan = browser.getCookieManager(); cookieMan.setCookiesEnabled(true); browser.getOptions().setRedirectEnabled(true); browser.getOptions().setThrowExceptionOnFailingStatusCode(false); browser.getOptions().setPrintContentOnFailingStatusCode(true); browser.getOptions().setThrowExceptionOnScriptError(false); //browser.getOptions().isPopupBlockerEnabled(); browser.addWebWindowListener(new WebWindowListener() { public void webWindowClosed(WebWindowEvent event) { System.out.println("---------------------------------------------- a window is CLOSED: " + event.getOldPage()); } public void webWindowContentChanged(WebWindowEvent event) { System.out.println("---------------------------------------------- webWindowContentChanged: "); } public void webWindowOpened(WebWindowEvent event) { System.out.println("---------------------------------------------- a NEW window opened: " + event.getNewPage()); windows.add(event.getWebWindow()); } }); } public static void main(String[] args) { doUASC(); } private static void doUASC() { try { // ------------------------------------------------------------------ search form HtmlPage page = (HtmlPage) browser.getPage("http://uasconline.uasc.net/Home"); String xpath = "//input[contains(@id, 'trackText')]"; HtmlTextInput searchTerm = (HtmlTextInput) page.getByXPath(xpath).get(0); xpath = "//a[contains(@onclick, 'subOnlineTrack()')]"; HtmlAnchor anchor = (HtmlAnchor) page.getByXPath(xpath).get(0); searchTerm.setText("CNQIN141696"); // booking number page = (HtmlPage) anchor.click(); List<HtmlElement> aEs = new ArrayList<HtmlElement>(); xpath = "//table[contains(@id, 'table-trackSummary')]"; HtmlTable table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor) { String cont_number = StringUtils.remove(row.getCell(2).asText(), " "); if (checkContainerNumber(cont_number)) { aEs.add(cont_anchor); break; } } } Iterator aeit = aEs.iterator(); while (aeit.hasNext()) { HtmlElement aE = (HtmlElement) aeit.next(); try { xpath = "//table[contains(@id, 'table-trackSummary')]"; table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor && StringUtils.containsIgnoreCase(aE.getTextContent(), cont_anchor.getTextContent())) { page = cont_anchor.click(); xpath = "//table[contains(@id, 'table-trackContainer')]"; List<HtmlTable> det_tables = (List<HtmlTable>) page.getByXPath(xpath); // do something... System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); break; } } } catch (Exception e) { System.out.println(e.toString()); } } if (true) { browser.closeAllWindows(); return; } } catch (Exception e) { System.out.println(e.toString()); } } private static boolean checkContainerNumber(String txt) { boolean match = false; if (!StringUtils.isEmpty(StringUtils.trim(txt))) { //String txt="abcd1234567"; String re1 = "((?:[a-z][a-z]+))"; // Word 1 String re2 = "(\\d+)"; // Integer Number 1 Pattern p = Pattern.compile(re1 + re2, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher m = p.matcher(txt); match = m.find(); } return match; } } ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 9:49 AM Subject: Re: [Htmlunit-user] Browser back button Hi, Then please post your complete case. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 9:45 AM Subject: Re: [Htmlunit-user] Browser back button Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: gaurab.pradhan <mer...@gm...> - 2015-05-21 10:37:00
|
Thank you so much Ahmed. This worked. :) -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-Too-much-redirect-tp36130p36139.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-21 10:12:23
|
Hi, You don't need to cross post ;) This is because HtmlUnit caches the response, and there is redirection to another page then returning back.I tested with the below, and it works:client.getCache().setMaxSize(0); Now, whether caching should consider the cookies, that's something to be decided. Ahmed From: gaurab.pradhan <mer...@gm...> To: htm...@li... Sent: Thursday, May 21, 2015 10:33 AM Subject: Re: [Htmlunit-user] How to handle Too much redirect Dear Ahmed, Thanks for your reply, yes i have subscribe. This is not my website, i want to parse the site but i getting above mention exception. WebClient client = new WebClient(BrowserVersion.FIREFOX_24); HtmlPage homePage = null; String url = "http://www.freelake.org/pages/Freetown-Lakeville_RSD/Departments/Director_of_Financial_Operatio"; try { client.getOptions().setUseInsecureSSL(true); client.setAjaxController(new NicelyResynchronizingAjaxController()); client.getOptions().setThrowExceptionOnFailingStatusCode(false); client.getOptions().setThrowExceptionOnScriptError(false); client.waitForBackgroundJavaScript(30000); client.waitForBackgroundJavaScriptStartingBefore(30000); client.getOptions().setCssEnabled(false); client.getOptions().setJavaScriptEnabled(true); homePage = client.getPage(url); synchronized (homePage) { homePage.wait(25000); } System.out.println(homePage.asXml()); } catch (Exception e) { e.printStackTrace(); } Thanks -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-Too-much-redirect-tp36130p36135.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: Roberto B. - A. <r.b...@af...> - 2015-05-21 09:02:38
|
Hi, this is my code .. the code (doUASC() ) try to get some data from a page : browser.getPage("http://uasconline.uasc.net/Home"); and then do a "back page" : System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); follows the full code . Thanks! Roberto package uasc; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.*; import com.gargoylesoftware.htmlunit.WebAssert.*; import com.gargoylesoftware.htmlunit.RefreshHandler; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.CookieManager; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.History; import com.gargoylesoftware.htmlunit.ScriptResult; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDivElement; import com.gargoylesoftware.htmlunit.javascript.host.Event; import com.gargoylesoftware.htmlunit.javascript.background.*; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.HttpMethod; import org.apache.commons.lang3.StringUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.io.IOException; import java.net.URL; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.*; import java.text.*; import java.net.URL; import java.util.LinkedList; import java.util.List; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.WebWindowEvent; import com.gargoylesoftware.htmlunit.WebWindowListener; import com.gargoylesoftware.htmlunit.html.HtmlButtonInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class UASC { static final WebClient browser; static final LinkedList<WebWindow> windows = new LinkedList<WebWindow>(); static { browser = new WebClient(BrowserVersion.FIREFOX_24); browser.getOptions().setJavaScriptEnabled(true); browser.setAjaxController(new NicelyResynchronizingAjaxController()); CookieManager cookieMan = new CookieManager(); cookieMan = browser.getCookieManager(); cookieMan.setCookiesEnabled(true); browser.getOptions().setRedirectEnabled(true); browser.getOptions().setThrowExceptionOnFailingStatusCode(false); browser.getOptions().setPrintContentOnFailingStatusCode(true); browser.getOptions().setThrowExceptionOnScriptError(false); //browser.getOptions().isPopupBlockerEnabled(); browser.addWebWindowListener(new WebWindowListener() { public void webWindowClosed(WebWindowEvent event) { System.out.println("---------------------------------------------- a window is CLOSED: " + event.getOldPage()); } public void webWindowContentChanged(WebWindowEvent event) { System.out.println("---------------------------------------------- webWindowContentChanged: "); } public void webWindowOpened(WebWindowEvent event) { System.out.println("---------------------------------------------- a NEW window opened: " + event.getNewPage()); windows.add(event.getWebWindow()); } }); } public static void main(String[] args) { doUASC(); } private static void doUASC() { try { // ------------------------------------------------------------------ search form HtmlPage page = (HtmlPage) browser.getPage("http://uasconline.uasc.net/Home"); String xpath = "//input[contains(@id, 'trackText')]"; HtmlTextInput searchTerm = (HtmlTextInput) page.getByXPath(xpath).get(0); xpath = "//a[contains(@onclick, 'subOnlineTrack()')]"; HtmlAnchor anchor = (HtmlAnchor) page.getByXPath(xpath).get(0); searchTerm.setText("CNQIN141696"); // booking number page = (HtmlPage) anchor.click(); List<HtmlElement> aEs = new ArrayList<HtmlElement>(); xpath = "//table[contains(@id, 'table-trackSummary')]"; HtmlTable table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor) { String cont_number = StringUtils.remove(row.getCell(2).asText(), " "); if (checkContainerNumber(cont_number)) { aEs.add(cont_anchor); break; } } } Iterator aeit = aEs.iterator(); while (aeit.hasNext()) { HtmlElement aE = (HtmlElement) aeit.next(); try { xpath = "//table[contains(@id, 'table-trackSummary')]"; table = (HtmlTable) page.getByXPath(xpath).get(0); for (HtmlTableRow row : table.getRows()) { String a_xpath = "a"; // anchor link HtmlElement cont_anchor = row.getCells().size() != 9 ? null : (HtmlElement) row.getCell(2).getFirstByXPath(a_xpath); if (cont_anchor != null && cont_anchor instanceof HtmlAnchor && StringUtils.containsIgnoreCase(aE.getTextContent(), cont_anchor.getTextContent())) { page = cont_anchor.click(); xpath = "//table[contains(@id, 'table-trackContainer')]"; List<HtmlTable> det_tables = (List<HtmlTable>) page.getByXPath(xpath); // do something... System.out.println(" trying to go back ..."); History history = browser.getWebWindows().get(0).getHistory(); // trying to go BACK !!! System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source BEFORE : \n" + page.asText() + "\n"); page.getEnclosingWindow().getHistory().back(); System.out.println("history.getIndex() : " + history.getIndex()); System.out.println("Text Source AFTER : \n" + page.asText() + "\n"); break; } } } catch (Exception e) { System.out.println(e.toString()); } } if (true) { browser.closeAllWindows(); return; } } catch (Exception e) { System.out.println(e.toString()); } } private static boolean checkContainerNumber(String txt) { boolean match = false; if (!StringUtils.isEmpty(StringUtils.trim(txt))) { //String txt="abcd1234567"; String re1 = "((?:[a-z][a-z]+))"; // Word 1 String re2 = "(\\d+)"; // Integer Number 1 Pattern p = Pattern.compile(re1 + re2, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher m = p.matcher(txt); match = m.find(); } return match; } } ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 9:49 AM Subject: Re: [Htmlunit-user] Browser back button Hi, Then please post your complete case. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 9:45 AM Subject: Re: [Htmlunit-user] Browser back button Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: gaurab.pradhan <mer...@gm...> - 2015-05-21 08:52:49
|
Dear Ahmed, Thanks for your reply, yes i have subscribe. This is not my website, i want to parse the site but i getting above mention exception. WebClient client = new WebClient(BrowserVersion.FIREFOX_24); HtmlPage homePage = null; String url = "http://www.freelake.org/pages/Freetown-Lakeville_RSD/Departments/Director_of_Financial_Operatio"; try { client.getOptions().setUseInsecureSSL(true); client.setAjaxController(new NicelyResynchronizingAjaxController()); client.getOptions().setThrowExceptionOnFailingStatusCode(false); client.getOptions().setThrowExceptionOnScriptError(false); client.waitForBackgroundJavaScript(30000); client.waitForBackgroundJavaScriptStartingBefore(30000); client.getOptions().setCssEnabled(false); client.getOptions().setJavaScriptEnabled(true); homePage = client.getPage(url); synchronized (homePage) { homePage.wait(25000); } System.out.println(homePage.asXml()); } catch (Exception e) { e.printStackTrace(); } Thanks -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-Too-much-redirect-tp36130p36135.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-21 07:52:08
|
Hi, Then please post your complete case. Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: Ahmed Ashour <asa...@ya...>; htm...@li... Sent: Thursday, May 21, 2015 9:45 AM Subject: Re: [Htmlunit-user] Browser back button Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto |
From: Roberto B. - A. <r.b...@af...> - 2015-05-21 07:45:53
|
Hi, it doesn't work.. i've tried this : page.asText(); page.getEnclosingWindow().getHistory().back(); page.asText(); but I see the same page Roberto ----- Original Message ----- From: Ahmed Ashour To: htm...@li... Sent: Thursday, May 21, 2015 1:48 AM Subject: Re: [Htmlunit-user] Browser back button Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: asashour <asa...@ya...> - 2015-05-21 05:51:01
|
Hi, - You must subscribe before posting - This hints about many redirect (which cause infinite loop), please fix the website. - If you still think this behavior is different than real browsers, then provide your complete case. Ahmed -- View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-handle-Too-much-redirect-tp36130p36131.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |
From: Ahmed A. <asa...@ya...> - 2015-05-20 23:51:45
|
Hi, You can get WebClient/Page from each other by something like: webClient.getWebWindows().get(0).getEnclosedPage(); page.getEnclosingWindow().getHistory().back(); Ahmed From: Roberto Bottoni - AfterBit <r.b...@af...> To: htm...@li... Sent: Wednesday, May 20, 2015 7:13 PM Subject: [Htmlunit-user] Browser back button Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto |
From: Roberto B. - A. <r.b...@af...> - 2015-05-20 17:27:05
|
Hi, I would like to simulate the browser "back button" and get the Html Page i searched internet.. and i have found this : webClient.getWebWindows().get(0).getHistory().back(); but.. how can i get the Html Page (if works the above command ) ? Thanks! Roberto |