[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-user
Subject:    Re: [Htmlunit-user] Parse web page to get data
From:       trideceth12 () msn ! com
Date:       2011-04-23 4:53:43
Message-ID: 1303534423.18757.8.camel () manko-desktop
[Download RAW message or body]

Try this:
[code]
HtmlParameter movie = page.getElementByName("movie");
        String myUrl =
"myUrl=hw"+movie.getValueAttribute().split("myUrl=hw")[1];
[/code]

myUrl should contain the value you're after

On Fri, 2011-04-22 at 19:04 -0700, albertkao wrote:
> I like to get the data containing the "myUrl=hw" from the web page
> "http://www.gnpcb.org/esv/search/?q=Romans+1"
> i.e. the value I am looking for is
> "myUrl=hw%2F45001001-45001032"
> What should be the "page.asXXX()" be?
> 
> [code]
> public class EsvRomansTest {
> 	@Test
> 	public void homePage() throws Exception {
> 	    final WebClient webClient = new WebClient();
> 	    final HtmlPage page =
> webClient.getPage("http://www.gnpcb.org/esv/search/?q=Romans+1");
> 
> 	    final String pageAsText = page.asText();
> 	    System.out.println("pageAsText\n" + pageAsText + "\n");
> 
>             // final String data = page.asXXX();
> 	    webClient.closeAllWindows();
> 	}
> }
> [/code]
> 



------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic