Using Selenium: how to change or enter in the HTTP Post Data Header header?

Please note that this question is related to selenium.

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

I want to enter a pair of name-level values ​​at my own level in an HTTP message back to the server, for example.

Change HTTP message from:

 POSTDATA=register=true&accountType=customer 

To:

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

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

Any ideas on how to achieve the desired result in selenium or something that can be called from selenium? Feel free to rate NJ

+4
source share
1 answer

In theory, you can use javascript or jQuery to change the page. For example, using jQuery you can add a hidden form element with a default value or a predefined value, which will then be passed when the form is submitted. (if I understand your question correctly - TamperData emulation?)

0
source

Source: https://habr.com/ru/post/1338538/


All Articles