From: Parham, C. <cp...@bi...> - 2015-08-13 18:17:32
|
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... 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); } } ________________________________ From: "Parham, Clinton" <cp...@bi...<mailto:cp...@bi...>> To: Ahmed Ashour <asa...@ya...<mailto:asa...@ya...>>; "htm...@li...<mailto:htm...@li...>" <htm...@li...<mailto:htm...@li...>> Sent: Thursday, August 13, 2015 5:12 AM Subject: Re: [Htmlunit-user] RichFaces 4 fileUpload Hi Ahmed, I have tested with the snapshot and get further. I no longer get script errors but the upload still doesn’t work. I’ve looked at the raw POST requests from HTMLUnit and compared to Firefox using Charles Proxy. They are quite different. I captured the requests when clicking the Upload button. Can you take a look and see what you think the problem might be? Thank you. ________________________________ 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. |