From: Vitor G. <vit...@gm...> - 2005-01-03 17:40:10
|
Hi, I'm trying to develop an Orkut Bot, that will gather information about friends and communities. Look at the code bellow: final WebClient client = new WebClient(BrowserVersion.MOZILLA_1_0); final HtmlPage page = (HtmlPage)client.getPage(new URL("http://www.orkut.com/Login.aspx") ); final HtmlForm form = page.getFormByName("f"); form.setAttributeValue("u", "username"); form.setAttributeValue("p", "password"); page = (HtmlPage)form.click(); System.out.println(page.asText()); When I execute this code, I can't get the initial page, Home.aspx. I followed the instructions about using JSSE, but the problem continues. Can anyone help me? Thanks, Vitor. |
From: Brad C. <yo...@br...> - 2005-01-03 18:41:18
|
What do you get back? Have you tried not setting a specific browser version and using the default full-featured browser? Brad C --- Vitor George <vit...@gm...> wrote: > Hi, > > I'm trying to develop an Orkut Bot, that will gather information about > friends and communities. Look at the code bellow: > > > final WebClient client = new WebClient(BrowserVersion.MOZILLA_1_0); > final HtmlPage page = (HtmlPage)client.getPage(new > URL("http://www.orkut.com/Login.aspx") ); > final HtmlForm form = page.getFormByName("f"); > form.setAttributeValue("u", "username"); > form.setAttributeValue("p", "password"); > page = (HtmlPage)form.click(); > System.out.println(page.asText()); > > When I execute this code, I can't get the initial page, Home.aspx. I > followed the instructions about using JSSE, but the problem continues. > > Can anyone help me? > > Thanks, > Vitor. > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: Vitor G. <vit...@gm...> - 2005-01-03 20:28:17
Attachments:
OrkutClient.java
|
Hi Brad, I've tried using the full-featured browser, and got the same error. The result of code attached is always the login form, because of the automatic redirect. Vitor On Mon, 3 Jan 2005 10:41:03 -0800 (PST), Brad Clarke <yo...@br...> wrote: > What do you get back? Have you tried not setting a specific browser version and > using the default full-featured browser? > > Brad C > > --- Vitor George <vit...@gm...> wrote: > > > Hi, > > > > I'm trying to develop an Orkut Bot, that will gather information about > > friends and communities. Look at the code bellow: > > > > > > final WebClient client = new WebClient(BrowserVersion.MOZILLA_1_0); > > final HtmlPage page = (HtmlPage)client.getPage(new > > URL("http://www.orkut.com/Login.aspx") ); > > final HtmlForm form = page.getFormByName("f"); > > form.setAttributeValue("u", "username"); > > form.setAttributeValue("p", "password"); > > page = (HtmlPage)form.click(); > > System.out.println(page.asText()); > > > > When I execute this code, I can't get the initial page, Home.aspx. I > > followed the instructions about using JSSE, but the problem continues. > > > > Can anyone help me? > > > > Thanks, > > Vitor. > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by: Beat the post-holiday blues > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > > _______________________________________________ > > Htmlunit-user mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: David D.K. <ddk...@ki...> - 2005-01-04 03:16:48
|
Why don't you want the result of submitting the login form? Instead, you're throwing away the result of the login form and replacing it with a new web page: // fetch and print the initial page url = new URL("http://www.orkut.com/Home.aspx"); page = (HtmlPage) client.getPage(url); Try commenting out the above two lines of code and see if you get the results you want. Dave On Jan 3, 2005, at 2:28 PM, Vitor George wrote: > Hi Brad, > > I've tried using the full-featured browser, and got the same error. > > The result of code attached is always the login form, because of the > automatic redirect. > > Vitor > > > On Mon, 3 Jan 2005 10:41:03 -0800 (PST), Brad Clarke > <yo...@br...> wrote: >> What do you get back? Have you tried not setting a specific browser >> version and >> using the default full-featured browser? >> >> Brad C >> >> --- Vitor George <vit...@gm...> wrote: >> >>> Hi, >>> >>> I'm trying to develop an Orkut Bot, that will gather information >>> about >>> friends and communities. Look at the code bellow: >>> >>> >>> final WebClient client = new WebClient(BrowserVersion.MOZILLA_1_0); >>> final HtmlPage page = (HtmlPage)client.getPage(new >>> URL("http://www.orkut.com/Login.aspx") ); >>> final HtmlForm form = page.getFormByName("f"); >>> form.setAttributeValue("u", "username"); >>> form.setAttributeValue("p", "password"); >>> page = (HtmlPage)form.click(); >>> System.out.println(page.asText()); >>> >>> When I execute this code, I can't get the initial page, Home.aspx. I >>> followed the instructions about using JSSE, but the problem >>> continues. >>> >>> Can anyone help me? >>> >>> Thanks, >>> Vitor. >>> >> > |
From: Vitor G. <vit...@gm...> - 2005-01-04 14:37:11
|
I riped off those lines, and changed the method form.click() to form.submit(), but I still get the login page (Login.aspx) back. On Mon, 3 Jan 2005 21:15:59 -0600, David D. Kilzer <ddk...@ki...> wrote: > Why don't you want the result of submitting the login form? Instead, > you're throwing away the result of the login form and replacing it with > a new web page: > > // fetch and print the initial page > url = new URL("http://www.orkut.com/Home.aspx"); > page = (HtmlPage) client.getPage(url); > > Try commenting out the above two lines of code and see if you get the > results you want. > > Dave > > > On Jan 3, 2005, at 2:28 PM, Vitor George wrote: > > > Hi Brad, > > > > I've tried using the full-featured browser, and got the same error. > > > > The result of code attached is always the login form, because of the > > automatic redirect. > > > > Vitor > > > > > > On Mon, 3 Jan 2005 10:41:03 -0800 (PST), Brad Clarke > > <yo...@br...> wrote: > >> What do you get back? Have you tried not setting a specific browser > >> version and > >> using the default full-featured browser? > >> > >> Brad C > >> > >> --- Vitor George <vit...@gm...> wrote: > >> > >>> Hi, > >>> > >>> I'm trying to develop an Orkut Bot, that will gather information > >>> about > >>> friends and communities. Look at the code bellow: > >>> > >>> > >>> final WebClient client = new WebClient(BrowserVersion.MOZILLA_1_0); > >>> final HtmlPage page = (HtmlPage)client.getPage(new > >>> URL("http://www.orkut.com/Login.aspx") ); > >>> final HtmlForm form = page.getFormByName("f"); > >>> form.setAttributeValue("u", "username"); > >>> form.setAttributeValue("p", "password"); > >>> page = (HtmlPage)form.click(); > >>> System.out.println(page.asText()); > >>> > >>> When I execute this code, I can't get the initial page, Home.aspx. I > >>> followed the instructions about using JSSE, but the problem > >>> continues. > >>> > >>> Can anyone help me? > >>> > >>> Thanks, > >>> Vitor. > >>> > >> > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: David D.K. <ddk...@ki...> - 2005-01-04 14:59:15
|
I think form.submit() will submit the form *without* actually "clicking" the Login button. It may sound counter-intuitive, but some web applications (esp. Jakarta Struts) require the button value to be submitted so that they know what action the user took. (I realize the web site is using ASP[X], but it may work in a similar fashion.) Try to get an object for the Login button (using the form object or the page object), then call click() on the Login button object, the see if the page object returned is what you're expecting. Remember, you must think like the web browser, or in other words, WWMWBD: "What would my web browser do?" :) Dave On Jan 4, 2005, at 8:36 AM, Vitor George wrote: > I riped off those lines, and changed the method form.click() to > form.submit(), but I still get the login page (Login.aspx) back. > > > On Mon, 3 Jan 2005 21:15:59 -0600, David D. Kilzer > <ddk...@ki...> wrote: > >> Why don't you want the result of submitting the login form? Instead, >> you're throwing away the result of the login form and replacing it >> with >> a new web page: >> >> // fetch and print the initial page >> url = new URL("http://www.orkut.com/Home.aspx"); >> page = (HtmlPage) client.getPage(url); >> >> Try commenting out the above two lines of code and see if you get the >> results you want. >> >> Dave > |