PDA

View Full Version : VBA getElementById doesn't work correctly



marsan
08-23-2017, 11:47 AM
I need help with VBA macro. It's about filling out the website form with excel data. The macro works fine, but the website does not respond corectly.

It is about the VBA command:

IE.Document.getElementById("rodzaj_uczestnika_id").Value = 1
Macro reads the correct value from the selection list (so macro works fine), but this should result in displaying the next fields to fill in on the website.

VBA code:


Sub lsi***()

Set IE = CreateObject("InternetExplorer.Application")


With IE
.Visible = True
.Navigate "https://lsi.slaskie.pl/#/fo_pefs"

Do While IE.ReadyState <> 4 And IE.Busy
DoEvents
Loop

End With


IE.Document.getElementById("rodzaj_uczestnika_id").Value = 1

End Sub

Code from the website:


<div class="container-fluid">

<div data-ng-controller="MsgCtrl" class="alert-container ng-scope">

<!-- ngRepeat: msg in queue -->
</div>


<!-- ngView: --><div data-ng-view="" class="ng-scope">



<div ng-switch="" on="action" class="ng-scope">
<!-- ngSwitchWhen: list -->
<!-- ngSwitchWhen: form --><div ng-switch-when="form" class="ng-scope"><!-- ngInclude: 'view/template?tpl=pefs/fo/form' --><div ng-include="'view/template?tpl=pefs/fo/form'" class="ng-scope">


<form novalidate="" class="form-horizontal ng-pristine ng-valid ng-scope ng-valid-maxlength" role="form">
<fieldset>
<legend><a class="powrot btn btn-sm btn-primary" title="powrót do listy bez zapisu" ng-click="cancel()">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>Edytuj/aktualizuj dane osoby</legend>

<div class="form-group ng-scope" lsi-validate="errors.rodzaj_uczestnika_id"> <label for="rodzaj_uczestnika_id" class="col-sm-3 control-label" "="">Rodzaj uczestnika</label> <div class="col-sm-9"> <select id="rodzaj_uczestnika_id" class="form-control input-sm ng-valid ng-dirty ng-valid-parse ng-touched" ng-model="key" ng-options="item.id as item.value for item in dict"><option value="" class=""></option><option value="0" label="indywidualny">indywidualny</option><option value="1" label="pracownik lub przedstawiciel instytucji/ podmiotu">pracownik lub przedstawiciel instytucji/ podmiotu</option></select> <!-- ngIf: errors.rodzaj_uczestnika_id --></div> </div>

<!-- ngIf: currItem.rodzaj_uczestnika_id==1 --><div ng-if="currItem.rodzaj_uczestnika_id==1" class="ng-scope">
<div lsi-pefs-inst="" class="form-group ng-pristine ng-untouched ng-valid ng-isolate-scope" ng-model="currItem.pefs_inst_id" lsi-office="fo" lsi-validate="currItem.errors.pefs_inst_id">



<label for="pefs_inst_id" class="col-sm-3 control-label">Instytucja/ podmiot</label>
<div class="col-sm-9">
<select id="pefs_inst_id" class="form-control input-sm ng-pristine ng-untouched ng-valid" ng-model="ngModel" ng-options="item.id as '['+item.nip+'] '+item.nazwa for item in inst"><option value="" class=""></option><option value="0" label="***"</option></select>
<!-- ngIf: currItem.errors.pefs_inst_id --></div>
</div>

So the website display this value. I can see the phrase "pracownik lub przedstawiciel instytucji", but the website does't read the next field to fill.
Can anyone help me please? VBA can do it?

marsan
08-24-2017, 06:59 AM
no one can help me? :)