From: Parham, C. <cp...@bi...> - 2015-08-20 13:15:28
|
Hi Ahmed, Did you find my attachments and see the POST requests? Thank you, Clint From: Parham, Clinton Sent: Thursday, August 13, 2015 2:12 PM To: 'Ahmed Ashour'; htm...@li... Subject: RE: [Htmlunit-user] RichFaces 4 fileUpload Hi Ahmed, I did attach three files to my earlier email: FirefoxFileUpload.txt – shows POST that Charles captured for FireFox HTMLUnitFileUpload.txt – shows POST that Charles captured for HTMLUnit HTMLUnitTestCase.java – code to reproduce I see them attached in my Sent Items. Should I send them another way? Also, the id that you have in your code “j_idt1245:upload” sometimes changes on the site when they update it. Today the id is “j_idt498:upload”. Thanks. From: Ahmed Ashour [mailto:asa...@ya...] Sent: Thursday, August 13, 2015 1:44 PM To: htm...@li...<mailto:htm...@li...> Subject: Re: [Htmlunit-user] RichFaces 4 fileUpload Hi again, There are no POST requests by Charles for the below code. Please post your code and provide compared results. Ahmed @Test public void testRichFacesFileUpload() throws Exception { final CollectingAlertHandler handler = new CollectingAlertHandler(); try (final WebClient webClient = new WebClient(BrowserVersion.CHROME, "localhost", 8888)){ webClient.setAlertHandler(handler); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); String url = "http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=fileUpload&skin=blueSky"; HtmlPage page = webClient.getPage(url); // choose file to upload HtmlInput htmlInput = (HtmlInput) page.getByXPath("//input[@type='file']").get(0); page = (HtmlPage) htmlInput.setValueAttribute("C:\\use\\chrome.PNG"); // click Upload button HtmlElement element = (HtmlElement) page.getByXPath( "//*[@id='j_idt1245:upload']/div[1]/span[1]/span[2]/span").get( 0); page = (HtmlPage) element.click(); } catch(Exception e) { System.out.println(e.getMessage()); } for (String x : handler.getCollectedAlerts()) { System.err.println(x); } } ________________________________ The contents contained herein may contain confidential information. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, printing or action taken on the contents is strictly prohibited. If you have received this email in error, please notify the sender immediately and delete this message. |