I am using http client POST method to perform specific action in a website ,
for that it uses javascript of ajax connection which produces a requestID
i.e var reqID = Math.floor(Math.random()*1000001);
to post .
I want to access that reqID to make the action performed .
can anyone help me regarding how to access a java script in HttpClient ?
Or can we access the specific reqID variable of javascript using HtmlUnit ?
My JS includes:
ajaxConnection.prototype.execute = function() {
var reqID = Math.floor(Math.random()*1000001);
var params = "reqID=" + reqID ;
for (var key in this.connection_parameters) {
params += "&" + key + "=" + this.connection_parameters[key];
}
and i am calling POST to get the action performed i.e
String Src = PageSource_Post("http://www.example.com/ajax/ratingClient.php", new String[][]{{"reqID",""},{"id", "329602"},{"cmd", "rate"},{"rating", "2"},}, null);
as of now i have kept the reqID blank and other parameters are getting from pagesource !
I am trying with HtmlUnit also like
webClient.setJavaScriptEnabled(true);
HtmlPage firstPage = webClient.getPage("http://www.example.com/");
HTMLScriptElement script = new HTMLScriptElement();
From here do i have to access the particular reqID
variable?