title: How to click a button using urlConnection (Programmatically)
body: <p>I'm trying to access an internal site project, This is the a part of the page source for the site</p>
  
  <pre><code>&lt;form method="post" action="doDelete"&gt;
       Are you sure you want to delete 'Apple?'?
   &lt;input name="Submit" value="Yes" class="submit-button" type="submit" /&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>I have this code</p>
  
  <blockquote>
    <p>doSubmit("http://ma.some-website:8080/member/Apple/delete","Yes");</p>
  </blockquote>
  
  <pre><code> public static void doSubmit(String url, String data) throws Exception {
      String content = "";
      URL siteUrl = new URL(url);
      HttpURLConnection conn = (HttpURLConnection) siteUrl.openConnection();
      conn.setRequestMethod("POST");
      conn.setDoOutput(true);
      conn.setDoInput(true);
      HttpURLConnection.setFollowRedirects( true );
      DataOutputStream out = new DataOutputStream(conn.getOutputStream());
  
          content =  URLEncoder.encode(data, "UTF-8");
  
      System.out.println(content);
      out.writeBytes(content);
      out.flush();
      out.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      String line = "";
      while((line=in.readLine())!=null) {
          System.out.println(line);
      }
      in.close();
  </code></pre>
  
  <p>}</p>
  
  <p>In the webpage there is a confirmation box asking if "i wish to delete this user(Apple)" how do i programmatically click that? I'm thinking i need to identify the method which is "doDelete" and pass in "Yes" parameter?</p>