How to get an HTML element that is not always displayed?

I am trying to create a program that will extract information from a website that my brothers' school uses to display your current grades.

I basically have everything set up, but I have problems with something.

I use WebBrowser for this, by the way, I know that I have to use WebRequests.

There is a summary (drop-down menu) that will be populated with a list of students who are registered with the parent account.

However, students are not loaded into the list box until a button is pressed.

I tried to make WebBrowser just click the combo box, but I could not get this to work.

Here is the HTML for Combobox:

<a id="droplist" tabindex="1" href="#students" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all ui-state-loading">SELECT A STUDENT<span class="ui-icon ui-icon-triangle-1-s"></span></a> 

Here is the HTML for the DIV that contains the names until they are loaded:

 <div id="students" class="hidden"> <ul></ul> </div> 

Here is the HTML for the DIV that contains the names in the combo box at startup:

 <div id="students" class="hidden"> <ul><li><a href="#" id="17743">Aaron P. Hailey </a></li><li><a href="#" id="16265">Aidan C. Hailey </a></li><li><a href="#" id="19305">Ethan B. Hailey </a></li></ul> </div> 

I suppose I will have to send an additional request for information or something like that, but can anyone think of a convenient workaround?

I am a noob for VB, so I have problems with this.

Thank you let me know if you need more information!

+4
source share
3 answers

fireEvent method - fires the specified event on the object.

After setting the dropdown value, you can try to raise an event (onchange) attached to the dropdown menu.

 doc.getElementById("droplist").selectedindex=1 doc.getElementById("droplist").FireEvent("onchange") 

Contact

+2
source

In the "combobox" you are viewing, an event listener is connected to it. On click, this is executed and an ajax request is made to the web server. You should be able to isolate the URI that returns the class data you need using the Chrome developer tools on the Network tab. This logs all HTTP requests made by the page. Once you have a URI, you can directly submit your request to it and, therefore, you can independently analyze the answer.

0
source

Once the fields are loaded onto the page, you can access their value with the standard val jquery function.

$ ('# field1') Shaft () ;.

-1
source

Source: https://habr.com/ru/post/1446121/


All Articles