Good afternoon, how can I click on Input in the html-коде using HttpURLConnection ?

 input type="submit" class="btn btn-primary btn-large" value="Логин" 

I assume that this action can be performed using setRequestProperty , just how?

Closed due to the fact that the essence of the question is not clear to the participants by Denis , sercxjo , user194374, rdorn , jmu 25 Aug '16 at 14:36 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Try to write more detailed questions. To get an answer, explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. Give a sample code. - Denis

1 answer 1

Using HttpURLConnection in any way. You can use the Headless browser, such as Selenium or HtmlUnit. HtmlUnit is not able to perform complex js, so I recommend Selenium and to it PhantomJsDriver

Since PhantomJS works as a browser (just not visible to the user) you need to install phantomjs-2.1.1-windows to it (unpack from archive to disk)

Here is a simple example found - https://www.appneta.com/blog/automated-testing-java/

  • can you give an example? - as1andrey1
  • And this lesson is better here, look at least in English, but it’s quite simple youtube.com/watch?v=AdcOPwFQbtg I studied it as well - by Andrey Sibirkin
  • After work, close the driver with the driver.quit () method, otherwise phantomjs.exe will hang in the task manager and eat RAM. - Andrey Sibirkin
  • and if I compile the program and send it to another PC where there are no phantomjs, will it work? - as1andrey1
  • you can throw in the folder with the project and everything will be ok I think - Andrey Sibirkin