简体   繁体   中英

Automate Input for Hidden Input Fields on ASPX Page

I am trying to automate the input to a website that uses the doPostBack menthod. However, all of the inputs are "type=hidden." Can these be accessed through automation using JavaScript or VBA, which I am using. Does anyone have working example. I've tried many ways using the getelementbyID, and some JavaScript functions to no avail. I have seen similar questions like this, but I have not seen a definitive answer for accessing them for automation when you are not the site admin.

Using pure javascript, you can set the value of a hidden input element as follows:

 document.getElementById("hidden").value = "hidden value"; document.getElementById("text").value = "text value"; 
 <form> <input type="hidden" id="hidden" name="hidden"> <input type="text" id="text" name="text"> <button type="submit" id="submit">Submit</button> </form> 

I would recommend though, that you look into using jQuery as this will simplify a lot of the tasks you might be implementing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM