HTMLUnit « HTMLUnit « Java Testing Q&A

Home
Java Testing Q&A
1.Development
2.FindBugs
3.HTMLUnit
4.hudson
5.junit
6.performance
7.plugin
8.profile
9.selenium
10.Tools
11.unit test
Java Testing Q&A » HTMLUnit » HTMLUnit 

1. is it possible to load a HtmlPage from a string?    stackoverflow.com

I have stored a webpage's HTML in the database. I want to take advantage of HtmlUnit's ability to find/reference DOM elements. Is it possible to load the HtmlPage object from a string (via ...

2. Using HtmlUnit, I have a HtmlTableRow, how can I get all its content as a string value?    stackoverflow.com

I am using HtmlUnit. I have an object of HtmlTableRow type, and I want to dump all of the content to a variable, how can I do this? i.e. just want to get ...

3. Can HtmlUnit handle JavaScript redirects?    stackoverflow.com

Instead of automatically following JavaScript redirects, can I force HtmlUnit to return the URL the JavaScript wants to redirect me to? // context: If there's 5 JavaScript redirects in a row, I can ...

4. Strange HtmlUnit behavior (bug?)    stackoverflow.com

WebClient client = new WebClient();
WebRequestSettings wrs = new WebRequestSettings(new URL("http://stackoverflow.com/ping/?what-the-duck?"), HttpMethod.HEAD);
client.getPage(wrs);
Running this code results in throwing FileNotFoundException, because HTTP Status code on the page is 404 and getting the same page ...

5. How can I use SOCKS with HtmlUnit?    stackoverflow.com

Is it possible to use HtmlUnit through SOCKS proxy? Could anyone please provide a code sample? ==== So I've dug through webclient sources, here's the best way I can think of:

  1. Subclass MultiThreadedHttpConnectionManager ...

6. How to limit HtmlUnit's history size?    stackoverflow.com

I'm using HtmlUnit for a parsing job and I've discovered that the memory gets wasted with the WebClient holding the history for each WebWindow. I don't use the history at all ...

7. Disable automatic Date parsing in HtmlUnit    stackoverflow.com

Having just upgraded to a newer version of HtmlUnit (2.4), I've noticed certain tests are failing when comparing the output of asText. Looking into the differences, this is because dates (present ...

8. Please help me to convert this java code to C#    stackoverflow.com

I'm using Htmlunit in my C# project, but I cannot convert this code in java to C#

webClient.setWebConnection(new HttpWebConnection(webClient) {
    public WebResponse getResponse(WebRequestSettings settings) throws IOException {
   ...

9. Getting the Text of a webpage with HtmlUnit?    stackoverflow.com

I'm just getting started with HTMLUnit and what I'm looking to do is take a webpage and extract out the raw text from it minus all the html markup. Can htmlunit accomplish ...

10. Java: how to setup htmlunit    stackoverflow.com

I'm a pretty big noob to Java, but I would like try out htmlunit. I'm using netbeans as my IDE and I've created a project folder "hu1". Here is the ...

11. HtmlUnit stops JavaScript execution after a window.open    stackoverflow.com

I've recently updated from HTMLUnit 2.4 to 2.5 (we'd go for the latest version but there is a lot of code to refactor due to the deprecated APIs). I'm now ...

12. What Exception is thrown on timeout?    stackoverflow.com

What Exception is thrown on connection timeout in HTMLUnit ?

13. How to use HtmlUnit in Java?    stackoverflow.com

I'm trying to use HtmlUnit in Java to log into a website. First i enter the user name then password. After that i need to select an option from a dropdown ...

14. htmlunit memory leaks    stackoverflow.com

Memory is going to increase by each loop cycle. Any idea why is it?

public static void main(String p[]) throws IOException {

        WebClient webClient = ...

15. htmlunit java change input text    stackoverflow.com

I use htmlunit. How i can set value of text input if it does not have an attribute 'value' ?

<input type="text" onkeypress="test();" id="id" name="name" class="ttt">
I tried this, but nothing
  ...

16. Java+HtmlUnit — problem with cyrillic urlencode    stackoverflow.com

I am trying to send some HTTP POST parameters to some web server and one of parameters contains cyrillic characters. So the problem is that if I use this code:


wc.getPage(requestSettings);

requestSettings.setHttpMethod(HttpMethod.POST);
requestSettings.setRequestParameters(new ArrayList());

requestSettings.getRequestParameters().add(new ...

17. Getting href from parent anchor HtmlUnit    stackoverflow.com

What I am trying to do is to use HtmlUnit to get the href from the parent anchor of a span. Here is what I mean.

  <a href="http://link.com/serv?id=jibberish&type=dynamic/changeseachvisit"><span>Some Unique Text</span></a>
There ...

18. HtmlUnit to view source    stackoverflow.com

HtmlUnit for Java is great but I haven't been able to figure out how to view the full source or return the source of a web site as a string. can ...

19. How to create HtmlUnit HTMLPage object from String?    stackoverflow.com

This question was asked once already, but the API changed I guess and the answers are no valid anymore.

URL url = new URL("http://www.example.com");
StringWebResponse response = new StringWebResponse("<html><head><title>Test</title></head><body></body></html>", url);
HtmlPage page = ...

20. Htmlunit - Tor - Privoxy    stackoverflow.com

Trying to debug/understand an issue that I'm having with trying to run a test with Htmlunit, running it using Tor with Privoxy as the Http Proxy Server. I've setup Tor/Privoxy on a ...

21. HTMLunit Massive Memory Leak    stackoverflow.com

So I've researched everything I can find on this subject, and I cannot for the life of me find a solution. I worked the problem into a small example, seen below. ...

22. HtmlUnit to use proxy from JVM properties    stackoverflow.com

it seems that HtmlUnit uses it's own centralized ProxyConfig object to set up proxy settings. Is there a way to make it ignore the ProxyConfig and use JVM properties https.proxyHost,https.proxyPort,http.proxyHost and ...

23. Calling getByXPath on DomNode with HtmlUnit    stackoverflow.com

I've extracted a List of DomNode objects from the HTMLPage object using getByXPath. However, when I try and query a returned DomNode object, again using getByXPath, the results are as if ...

24. How to search YouTube with HtmlUnit    stackoverflow.com

I wonder if YouTube could be searched with HtmlUnit. I started to write code, here it is:

import java.io.IOException;
import java.net.MalformedURLException;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;

public class HtmlUnitExampleTestBase {
 ...

25. Can't catch the exception - Java with HtmlUnit?    stackoverflow.com

I don't understand what's going on ??? I have the following code :

public static void main(String[] args){ 

    WebClient wc = null;
    HtmlPage hp = null;
 ...

26. HtmlUnit: Open JS link with target=blank?    stackoverflow.com

I have some site with some page. There are a few links with target=_blank on the page with hrefs like this: javascript:open('somepage.php?lala=lala&lolol=lolol') So HtmlUnit 2.8 and 2.9 opens it in the new window ...

27. How do you set up "test mode" for your Java app?    stackoverflow.com

I am working on a Java web app with unit tests that deploy the app in Jetty. I use HtmlUnit to hit the app and do some high level tests. I ...

28. Using HTMLUnit to test Java script    stackoverflow.com

I'm trying to learn how to use HTMLUnit in order to test some website's JavaScripts elements. I've tried doing some homework and using the HTMLUnit's How-To's but with no success. I get ...

29. Chrome support for htmlunit    bytes.com

Hi, I am planning to use htmlunit for my web test.As per Htmlunit API,it doesn't support chrome browser. Anybody ever tried to test the web application in chrome browser using htmlunit. ...

30. Java HtmlUnit    coderanch.com

Hi, I'm trying to use HtmlUnit to login to my local wordpress website but it seems to have a cookies issue. That's that begining of the code: WebClient webClient = new WebClient(); HtmlPage loginPage = webClient.getPage("http://localhost/flowersWp/wp-admin"); HtmlForm form = loginPage.getFormByName("loginform"); Nov 27, 2010 12:43:35 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Cookie rejected: "[version: 0][name: wordpress_2418eeb845ebfb96f6f1a71ab8c5625a][value: +][domain: localhost][path: /flowersWp/wp-admin][expiry: Fri Nov 27 12:43:35 IST ...

31. use of pressAccessKey in htmlunit    java-forums.org

hello i need to use of " public HtmlElement pressAccessKey(char accessKey) throws IOException" for press desired key on the webpage that read by function "HtmlPage getPage()" in the htmlunit library so for test an learn this function i use this code but not work " form.getInputByName("data[title]").click(); page.setFocusedElement(form.getInputByName("data[title]")) page.pressAccessKey('a'); " while this code work correct " form.getInputByName("data[title]").setValueAttribute(Title); " so i need to ...

32. using of htmlunit library    java-forums.org

Hi I am using of htmlunit library and Firebug addon for firefox and for example fill textbox in google and click search with this code: public static void main() throws IOException{ WebClient browser; browser = new WebClient(); HtmlPage page; page=(HtmlPage) browser.getPage("www.google.com"); HtmlForm form=page.getFormByName("f"); form.getInputByName("q").setValueAttribute("search topic"); page=(HtmlPage) form.getInputByName("btnG").click(); } but i have problem with componet like component that we write our mail ...

33. Problem in using HtmlUnit    forums.oracle.com

34. using of htmlunit library    forums.oracle.com

35. assertEquals and HtmlUnit    forums.oracle.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.