Answer the question
In order to leave comments, you need to log in
Is it possible to click on a button on a site using bash and parse the response from the form?
Hello dear gurus!
there is a button on the site
<span class="b-form-button__content">
<span class="b-form-button__text">Проверить файл</span></span>
Answer the question
In order to leave comments, you need to log in
You need to track which link is sent when the button is clicked and what parameters are passed in the POST (most likely) request.
I'll use Google Chrome as an example. Open console ctrl+shift+j
Network tab.
We press the button and then look for the name of the link in the left column and click the desired link.
Open the Headers tab on the right. We are looking for a line of the Form Data type
; all the headers passed in the POST request are listed there.
If you right-click on the link name and select "Copy as cURL" - the full link for curl will be copied to the clipboard, which can be used in a bash script
If there is an answer, then there is a request, and if there is a request, then it can be sent, and if it is sent, then the answer will arrive. Here is the answer to your question - no need to press a button on the site using bash to parse the answer from the form.
Can.
There is such a project called selenium . It allows you to control the browser through RemoteDriver. This protocol is implemented through the REST API .
There are official drivers from the project itself for different languages, there are unofficial ones. But nothing prevents you from implementing this protocol on bash, via curl, for example.
The essence is this: you start the selenium server, connect to it, make the right requests, save the received data. In your case, you need to send a request to create a session, save the received Id and use it for further requests. I threw the description of the protocol, delve into it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question