5 Replies Latest reply: Apr 19, 2012 3:24 AM by gimbal2 RSS

    Accessing web page and its events using java

    931492
      Hi All,
      My requirement is to access a webpage and trigger the events (Ex : button click or clicking a url) using java. It should lead to the next page of the web. I want to do it automatically using java. Can someone pls help on how to do in java. Any java API s for this.

      Edited by: 928489 on 18-Apr-2012 06:06
        • 1. Re: Accessing web page and its events using java
          jtahlborn
          this http://htmlunit.sourceforge.net/ can model web page interactions in java code.
          • 2. Re: Accessing web page and its events using java
            tschodt
            928489 wrote:
            Subject: Accessing web page and its events using java
                   My requirement is to access a webpage
            Supporting all of the standard web browsers (I.E., Firefox, Chrome, Safari, Opera)?
            and trigger the events (Ex : button click or clicking a url) using java.
            It should lead to the next page of the web. I want to do it automatically using java.
            Do you mean javascript?
            This sounds like AJAX.
            • 3. Re: Accessing web page and its events using java
              handat
              sounds more like OP wants to write a robot/crawler using java
              • 4. Re: Accessing web page and its events using java
                931492
                How to get the browser control i.e. connecting using proxy. Im getting the following exception when i try to connect to the website link using java.

                Exception in thread "main" java.net.SocketTimeoutException: connect timed out
                at java.net.PlainSocketImpl.socketConnect(Native Method)
                at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
                at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
                at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
                at java.net.Socket.connect(Socket.java:519)
                at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550)
                at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
                at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
                at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
                at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:271)
                at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:328)
                at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
                at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:778)
                at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
                at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
                at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:404)
                at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:391)
                at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:157)
                at org.jsoup.helper.HttpConnection.get(HttpConnection.java:146)
                at ListLinks.main(ListLinks.java:15)
                • 5. Re: Accessing web page and its events using java
                  gimbal2
                  I wonder what "browser control" has anything to do with making a socket connection to a webserver through a proxy server :/

                  Anyway:

                  http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html