1

I am faced with a web-based service where I can fill a form in the Chrome browser and click the submit button. Alas, I need to do the repetitive fill/submit routine dozens of times, which is error-prone.

I looked at the page source, the form looks like

<form method="post" id="add-form">
...
    <button type="submit" ...>Submit</button>
</form>

I this gives me hope that I should be able to automate the process by creating a template JSON, editing it programmatically, and feeding it to multiple curl --data invocations (or maybe --form instead?)

Q0: is this still the right place to ask this question? (maybe there is already a special SE site for such?)

Q1: how do I figure out what exactly is sent by chrome on submit? (chrome has inspect menu option - is this relevant?) Should I use --form or --data?

Q2: how do I figure out where the POST is sent to? (end-point URL)

PS. I cannot use Firefox or Brave here; MS Edge is the only alternative.

7
  • BTW, a <form method="post"> does not use JSON - it uses application/x-www-form-urlencoded which is a flat list of name+value pairs (name is nonunique, otherwise it'd be key+value pairs). Commented Nov 13, 2024 at 23:02
  • "is this the right place to ask this question?" - your have 59,800 karma; you've been around here long enough to know the answer to this. Commented Nov 13, 2024 at 23:03
  • "how do I figure out what exactly is sent by chrome on submit?" - look for the POST request in the Network tab, in the drill-down there's a formatted listing of the form-fields (names and values) that were sent. Commented Nov 13, 2024 at 23:04
  • "how do I figure out where the POST is sent to?" - A` <form>` without an action="" attribute will be submitted to the same URI as the page itself - so use whatever is in your Address-bar - otherwise the POST request's URI will be in the Network tab, as with the above. Commented Nov 13, 2024 at 23:05
  • "How do I use curl instead of chrome?" - Chromium (incl Chrome and Edge) has an "Save request to cURL script" feature, just right-click the request in the Network tab and it spits-out a .sh text-file with the field-values in - just open, edit, save, and run ./do-request.sh. Commented Nov 13, 2024 at 23:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.