Skip to content
Advertisement

Python helium get contents of table after click

I am using helium to scrape a webpage.

JavaScript

After the click action i am presented with a table and i need to scrape the contents of the table but How do i select the table after the click ?

Advertisement

Answer

You would need to use find_elements_... to get all <table>, and use for-loop to work with every table separatelly amd use (nested) for-loop to get <tr> (row) and <th> (header) in table, and use (nested) for-loop to get <td> (cell) in row. And you would have to add elements to correct (nested) lists.


But this page uses normal <table> and this table is all time in HTML (not added by javaScript) so it can be simpler to use pandas.read_html() to get all <table>

JavaScript

Result

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement