Using Selenium : How to modify or inject into HTTP Post Data Request Header?

2k views Asked by At

Please note this question is related to Selenium.

Before a HTML form submit i.e., selenium.click("//button[@type='submit']");

I want to inject a name value pair at native level in the HTTP Post back to the Server e.g.

Change HTTP Post from:

POSTDATA=register=true&accountType=customer

To:

POSTDATA=register=true&accountType=customer&mynewfield=true

Working with Selenium commands its not obvious how to intercept and modify what is posted back to the server.

Any ideas of how to achieve desired result in Selenium or something that can be called from Selenium? Kindly appreciated NJ

1

There are 1 answers

0
trimper On

In theory you could use javascript or jQuery to alter the page. For example, using jQuery you could add a hidden form element with a default value or pre-set value that will then be passed upon form submission. (if i understand your question right - emulating TamperData?)