From: Vasudevan C. <vco...@gm...> - 2018-01-23 20:38:39
|
Hi, I have been using htmlunit 2.23 version. I wanted to know if it is possible to set the content-type as multipart/form-data in HTTPRequestHEader and post a form. Is it possible to achieve the above scenario without creating a sample html file and click on the submit button? Thanks for your input & suggestions in advance. Regards Vasu |
From: Ronald B. <rb...@rb...> - 2018-01-24 19:27:21
|
Hi Vasu, i'm not sure that i got your point. Do you like * to manipulate the form before clicking the submit button or * have you created your own WebRequest and like to change the encoding type? Maybe you can illustrate your ide with some (pseudo) code RBRi BTW: 2.29 and 2.30 is on the way >Hi, > > I have been using htmlunit 2.23 version. I wanted to know if it is >possible to set > the content-type as multipart/form-data in HTTPRequestHEader and post a >form. > > Is it possible to achieve the above scenario without creating a sample >html file > and click on the submit button? > > Thanks for your input & suggestions in advance. > >Regards > Vasu |
From: Vasudevan C. <vco...@gm...> - 2018-01-24 19:38:41
|
Hi Ronald, I am constructing my own WebRequest with HTTPMethod set to POST. I construct the NameValue Pair and POST the request. I see HTMLUnit set the content-type to x-form-encoded in this case. However, I want the similar feature to construct a multi-part/formencoded content-type in HTMLUnit. Is it possible? I have another question. For one of the sites, the client(javascript) is setting a cookie value and sending it to the server. Is it possible in HTMLUnit to add that cookie to the cookie manager of Webclient using addCookie Method?. Will that work. Because, such a call does not set the Cookie in HTMLUnit in later version. Earlier versions of HtmlUnit 2.9, I was able to do that. Looking forward to your reply. Regards Vasu On 25 January 2018 at 00:57, Ronald Brill <rb...@rb...> wrote: > Hi Vasu, > > i'm not sure that i got your point. > Do you like > * to manipulate the form before clicking the submit button or > * have you created your own WebRequest and like to change the encoding > type? > > Maybe you can illustrate your ide with some (pseudo) code > > RBRi > > BTW: 2.29 and 2.30 is on the way > > > >Hi, > > > > I have been using htmlunit 2.23 version. I wanted to know if it is > >possible to set > > the content-type as multipart/form-data in HTTPRequestHEader and post a > >form. > > > > Is it possible to achieve the above scenario without creating a sample > >html file > > and click on the submit button? > > > > Thanks for your input & suggestions in advance. > > > >Regards > > Vasu > > |
From: Ronald B. <rb...@rb...> - 2018-01-24 19:42:03
|
yourWebRequest.setEncodingType(FormEncodingType.MULTIPART); Hope the same methods are available in your old version also RBRi On Thu, 25 Jan 2018 01:08:33 +0530 Vasudevan Comandur wrote: > >Hi Ronald, > > I am constructing my own WebRequest with HTTPMethod set to POST. > > I construct the NameValue Pair and POST the request. I see HTMLUnit set >the content-type to x-form-encoded in this case. > > However, I want the similar feature to construct a >multi-part/formencoded content-type in HTMLUnit. Is it possible? > > I have another question. For one of the sites, the client(javascript) >is setting a cookie value and sending it to the server. Is it possible > in HTMLUnit to add that cookie to the cookie manager of Webclient >using addCookie Method?. Will that work. Because, such a call does > not set the Cookie in HTMLUnit in later version. Earlier versions of >HtmlUnit 2.9, I was able to do that. > > Looking forward to your reply. > >Regards > Vasu > > > > >On 25 January 2018 at 00:57, Ronald Brill <rb...@rb...> wrote: > >> Hi Vasu, >> >> i'm not sure that i got your point. >> Do you like >> * to manipulate the form before clicking the submit button or >> * have you created your own WebRequest and like to change the encoding >> type? >> >> Maybe you can illustrate your ide with some (pseudo) code >> >> RBRi >> >> BTW: 2.29 and 2.30 is on the way >> >> >> >Hi, >> > >> > I have been using htmlunit 2.23 version. I wanted to know if it is >> >possible to set >> > the content-type as multipart/form-data in HTTPRequestHEader and post a >> >form. >> > >> > Is it possible to achieve the above scenario without creating a sample >> >html file >> > and click on the submit button? >> > >> > Thanks for your input & suggestions in advance. >> > >> >Regards >> > Vasu >> >> > > |
From: Vasudevan C. <vco...@gm...> - 2018-04-09 18:53:38
|
Hi All, I am creating a Web Request object with the URL and the method is set to POST and setting the FormEncoding Type to MULTIPART. How do I upload a file?. I know the name of the file and its path. DO I need create a dummy form with a submit Button? I appreciate your help. Regards Vasu On 25 January 2018 at 01:11, Ronald Brill <rb...@rb...> wrote: > yourWebRequest.setEncodingType(FormEncodingType.MULTIPART); > > Hope the same methods are available in your old version also > > RBRi > > On Thu, 25 Jan 2018 01:08:33 +0530 Vasudevan Comandur wrote: > > > >Hi Ronald, > > > > I am constructing my own WebRequest with HTTPMethod set to POST. > > > > I construct the NameValue Pair and POST the request. I see HTMLUnit > set > >the content-type to x-form-encoded in this case. > > > > However, I want the similar feature to construct a > >multi-part/formencoded content-type in HTMLUnit. Is it possible? > > > > I have another question. For one of the sites, the client(javascript) > >is setting a cookie value and sending it to the server. Is it possible > > in HTMLUnit to add that cookie to the cookie manager of Webclient > >using addCookie Method?. Will that work. Because, such a call does > > not set the Cookie in HTMLUnit in later version. Earlier versions of > >HtmlUnit 2.9, I was able to do that. > > > > Looking forward to your reply. > > > >Regards > > Vasu > > > > > > > > > >On 25 January 2018 at 00:57, Ronald Brill <rb...@rb...> wrote: > > > >> Hi Vasu, > >> > >> i'm not sure that i got your point. > >> Do you like > >> * to manipulate the form before clicking the submit button or > >> * have you created your own WebRequest and like to change the encoding > >> type? > >> > >> Maybe you can illustrate your ide with some (pseudo) code > >> > >> RBRi > >> > >> BTW: 2.29 and 2.30 is on the way > >> > >> > >> >Hi, > >> > > >> > I have been using htmlunit 2.23 version. I wanted to know if it is > >> >possible to set > >> > the content-type as multipart/form-data in HTTPRequestHEader and > post a > >> >form. > >> > > >> > Is it possible to achieve the above scenario without creating a > sample > >> >html file > >> > and click on the submit button? > >> > > >> > Thanks for your input & suggestions in advance. > >> > > >> >Regards > >> > Vasu > >> > >> > > > > > > |
From: Vasudevan C. <vco...@gm...> - 2018-01-29 13:32:42
|
Hi Ronald. Setting a cookie at the client side using addCookie to the webclient after constructing a Cookie does not seem to work. I am instantiating a webClient instance with Javascript disabled. The server has sent a set of cookies which are stored in the CookieManager of the webclient instance. Now, I want to add one more cookie from the client side. I constructed the cookie using New Cookie with the necessary parameters. The domain value is set to ".naukri.com". I add the new cookie using AddCookie Method for the corresponding cookieManager. I checked through Charles if the new Cookie value is set. BUt unfortunately it is not. Am I missing something?. I am using HTMLUnit 2.23. The same set of calls worked on HtmlUnit 2.9. Appreciate your help in advance. Regards Vasu On 25 January 2018 at 01:37, Ronald Brill <rb...@rb...> wrote: > > The second question on setting a Cookie by the client using Javascript. > >Can I accomplish the same without enabling Javscript for a WebClient > > instance and set the cookie using addCookie Method. I am using 2.23 > >right now. > > I think yes; the javascript call does also calls this method with the > current page and the webclient as param > > RBRi > -------------------------- > WETATOR > Smart web application testing > http://www.wetator.org > |
From: Ronald B. <rb...@rb...> - 2018-01-29 18:49:34
|
> Setting a cookie at the client side using addCookie to the webclient >after constructing a Cookie does not seem to work. Sorry but i can only guess. the version you are using is realy outdated and i have no time to support this version. > I am instantiating a webClient instance with Javascript disabled. The >server has sent a set of cookies which are stored in the CookieManager of >the webclient instance. > > Now, I want to add one more cookie from the client side. > > I constructed the cookie using New Cookie with the necessary >parameters. The domain value is set to ".naukri.com". > > I add the new cookie using AddCookie Method for the corresponding >cookieManager. Sounds good so far. Set a breakpoint CookieManager.getCookies() and check if you cookie is part of the result. If yes try to figure out who of the following calls ignors your one (might be HttpClient) Try with cookie with host name also ronald > I checked through Charles if the new Cookie value is set. BUt >unfortunately it is not. > > Am I missing something?. I am using HTMLUnit 2.23. The same set of >calls worked on HtmlUnit 2.9. > > Appreciate your help in advance. > >Regards > Vasu > >On 25 January 2018 at 01:37, Ronald Brill <rb...@rb...> wrote: > >> > The second question on setting a Cookie by the client using Javascript. >> >Can I accomplish the same without enabling Javscript for a WebClient >> > instance and set the cookie using addCookie Method. I am using 2.23 >> >right now. >> >> I think yes; the javascript call does also calls this method with the >> current page and the webclient as param >> >> RBRi >> -------------------------- >> WETATOR >> Smart web application testing >> http://www.wetator.org >> > > |
From: Vasudevan C. <vco...@gm...> - 2018-01-30 13:40:16
|
Hi Ronald, Today, I tried creating the Cookie with the host name. That cookie value was getting set and sent to the host also. Looks like the Cookie should have the host name set instead of partial host name. Thanks for the pointer. Regards Vasu On 30 January 2018 at 01:19, Ronald Brill <rb...@rb...> wrote: > > Setting a cookie at the client side using addCookie to the webclient > >after constructing a Cookie does not seem to work. > > Sorry but i can only guess. the version you are using is realy outdated > and i have no time to support this version. > > > I am instantiating a webClient instance with Javascript disabled. The > >server has sent a set of cookies which are stored in the CookieManager of > >the webclient instance. > > > > Now, I want to add one more cookie from the client side. > > > > I constructed the cookie using New Cookie with the necessary > >parameters. The domain value is set to ".naukri.com". > > > > I add the new cookie using AddCookie Method for the corresponding > >cookieManager. > > Sounds good so far. Set a breakpoint CookieManager.getCookies() and check > if you cookie is part of the result. > If yes try to figure out who of the following calls ignors your one (might > be HttpClient) > Try with cookie with host name also > > ronald > > > > > I checked through Charles if the new Cookie value is set. BUt > >unfortunately it is not. > > > > Am I missing something?. I am using HTMLUnit 2.23. The same set of > >calls worked on HtmlUnit 2.9. > > > > Appreciate your help in advance. > > > >Regards > > Vasu > > > >On 25 January 2018 at 01:37, Ronald Brill <rb...@rb...> wrote: > > > >> > The second question on setting a Cookie by the client using > Javascript. > >> >Can I accomplish the same without enabling Javscript for a WebClient > >> > instance and set the cookie using addCookie Method. I am using 2.23 > >> >right now. > >> > >> I think yes; the javascript call does also calls this method with the > >> current page and the webclient as param > >> > >> RBRi > >> -------------------------- > >> WETATOR > >> Smart web application testing > >> http://www.wetator.org > >> > > > > > > |