开发者

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

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 fr开发者_运维技巧om Selenium? Kindly appreciated NJ


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?)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜