I do not know a thing about HTML, I have experience mainly with Python and VBA, so do not expect me to elaborate a lot on what my possible solution might be.
I have to fill some forms on a website and this could be automated, because all the data that needs to be put in the text-boxes on the website is already stored in an Excel sheet.
My idea would just to make VBA make a ".txt"-File to copy and paste it on the console of the web browser and just make the questionnaires of the web site be filled semi-automatically.
I have identified the elements of the text-boxes in the HTML source code of the website in the <body>
and looks like this:
<app-store-input _ngcontent-ngi-c61="" _nghost-ngi-c56="" class="ng-star-inserted">
<app-input _ngcontent-ngi-c56="" _nghost-ngi-c55="">
<div _ngcontent-ngi-c55="" class="labels">
<label _ngcontent-ngi-c55="" class="label"> NAME </label>
<label _ngcontent-ngi-c55="" class="error-label" style="position: absolute; right: 0; bottom: 23px; margin-left: auto; margin-right: 15px;" hidden="">
</label>
</div>
<input _ngcontent-ngi-c55="" type="text" maxlength="150" placeholder="" title="" class="ng-dirty ng-valid ng-touched" required="">
#shadow-root (user-agent)
<div pseudo="-webkit-input-placeholder" id="placeholder" style="display: none !important;"></div>
<div>MyName</div>
</app-input>
</app-store-input>
I have already identified that my input for the "Name" section with the label NAME
, is marked in the <input>
, under the #shadow-root
. Here I wrote MyName
as what I would write in the text-box of the website. There are a lot more of this text-boxes, but for simplicity’s sake, I just took this one as an example.
I would have tried something like:
_ngcontent-ngi-c55.NAME = MyName
I would have used the label "NAME", because all other text-boxes look exactly the same with the same code, the only difference is the label, e.g. one is "NAME", the other "SURNAME", the other "ADRESS" and so on.
I have also tried the function of recording the actions on Chrome to do a "Performance" check of the website as a developer, but this throws a JSON-File which has to be inserted again in the "Record" part of developer tools for Chrome, not the console. This is only a half-solution, as I do not want to depend on a feature of Google Chrome to always be able to do this and I would like a universal and native solution to the console of web browsers.
Thank you all in advance.
2
Answers
This can be achieved with a function like this. This just help you to fill your form easily.
First, try this script:
Explanation:
placeholderMap
, which will be a Javascript object of key-value pairs where the keys represent the placeholders you want to replace and the values represent the value you intend to replace them withquerySelectorAll
needs to be adjusted accordingly)