How to manipulate AJAX POST data before send using WEBDRIVER ( JAVA )

I want to manipulate data before sending post data which is the using HTML page JQuery .

There is sending JSon post data below . First loading page after second sending this data .... At this this point I want to manipulate JSon data then sent form .

posts *[["qe:expose", Object { qe="su"}, 1457652370400, 0], ["slipstream:pageview", Object { description="unifiedHome", event_name="pageview", platform="web", more...}, 1457652370456, 0], ["slipstream:action", Object { description="fbLoginFallback", event_name="action", extra="{"gk":{"rhp":true},"qe":...0106"},"type":"signup"}", more...}, 1457652371149, 0]]*

Data sending url , method post :

I want to manipulate some data from there .

It's possible with WEBDRIVER ? I'm using JAVA.

Could you help me about this ? I searched but i didn't found answer. I hope it's possible and you can help me about that.

Thank you all !


It's possible by injecting a piece of JavaScript.

If what you need just requires to simply force an input then :

WebDriver driver = new FirefoxDriver();
((JavascriptExecutor)driver).executeScript("$('...').val('new value');");
driver.findElement(By.cssSelector("...")).click();  //submit

You could also hook the post function :

WebDriver driver = new FirefoxDriver();
  "var ajax = $.ajax;" +
  "$.ajax = function(url, settings) {" +
  "  alert('post intercepted');" +
  "  ajax.apply(this, arguments);" +
driver.findElement(By.cssSelector("...")).click();  //submit

Need Your Help

Fill youtube comment field with Imacros

youtube comments imacros

When i want to fill the youtube comment field, my macro doesn't do anything. It's interesting, if i want to extract the content, it works fine.

How to make text stay inside a div box and continue on next line when it reaches the edge of div box?

javascript html css angularjs

So I'm making this flash card app, and I'm using Angular to let the user enter text in an input text box and the text displays on a flash card below it. The problem is that when the user types a lo...