Submit form option before scraping

I want to scrape lab results, however by default they are displayed only for current month and I need for all months. In form #mes I want to select option 1 (all months) and then click the submit button "buscar" before scraping. Is it possible? If not directly, is it possible to execute a javascript before scraping?

Thank you for any guidance.

Url: Análisis de sustancias - Energy Control

Sitemap:
{"_id":"ec_resultados","startUrl":["https://energycontrol.org/analisis-de-sustancias/"],"selectors":[{"id":"wrapper","parentSelectors":["_root"],"type":"SelectorElement","selector":"table","multiple":false,"delay":0},{"id":"BADGE","parentSelectors":["rows selector"],"type":"SelectorText","selector":"td:nth-of-type(2), th[rowspan]:nth-of-type(2)","multiple":false,"delay":0,"regex":""},{"id":"TITLE 1/2","parentSelectors":["rows selector"],"type":"SelectorText","selector":"td:nth-of-type(3) strong","multiple":false,"delay":0,"regex":""},{"id":"TITLE 2/2","parentSelectors":["rows selector"],"type":"SelectorText","selector":"td:nth-of-type(3)","multiple":false,"delay":0,"regex":""},{"id":"TEXT 1/2","parentSelectors":["rows selector"],"type":"SelectorText","selector":"th:nth-of-type(5), td:nth-of-type(6)","multiple":false,"delay":0,"regex":""},{"id":"link","parentSelectors":["rows selector"],"type":"SelectorLink","selector":".Tablet a","multiple":false,"delay":0},{"id":"TEXT 2/2","parentSelectors":["rows selector"],"type":"SelectorText","selector":"td:nth-of-type(5)","multiple":false,"delay":0,"regex":""},{"id":"img","parentSelectors":["rows selector"],"type":"SelectorImage","selector":"div:nth-of-type(1) img","multiple":false,"delay":0},{"id":"rows selector","parentSelectors":["wrapper"],"type":"SelectorElement","selector":"tbody tr","multiple":true,"delay":0}]}

@jureka Hi. In order to select the desired option and execute the search you will have to add 2 additional click selectors, which in order should be before the table selector.

Practical example:

{"_id":"ec_resultados","startUrl":["https://energycontrol.org/analisis-de-sustancias/"],"selectors":[{"delay":0,"id":"BADGE","multiple":false,"parentSelectors":["rows selector"],"regex":"","selector":"td:nth-of-type(2), th[rowspan]:nth-of-type(2)","type":"SelectorText"},{"delay":0,"id":"TITLE 1/2","multiple":false,"parentSelectors":["rows selector"],"regex":"","selector":"td:nth-of-type(3) strong","type":"SelectorText"},{"delay":0,"id":"TITLE 2/2","multiple":false,"parentSelectors":["rows selector"],"regex":"","selector":"td:nth-of-type(3)","type":"SelectorText"},{"delay":0,"id":"TEXT 1/2","multiple":false,"parentSelectors":["rows selector"],"regex":"","selector":"th:nth-of-type(5), td:nth-of-type(6)","type":"SelectorText"},{"delay":0,"id":"link","multiple":false,"parentSelectors":["rows selector"],"selector":".Tablet a","type":"SelectorLink"},{"delay":0,"id":"TEXT 2/2","multiple":false,"parentSelectors":["rows selector"],"regex":"","selector":"td:nth-of-type(5)","type":"SelectorText"},{"delay":0,"id":"img","multiple":false,"parentSelectors":["rows selector"],"selector":"div:nth-of-type(1) img","type":"SelectorImage"},{"delay":0,"id":"rows selector","multiple":true,"parentSelectors":["table-wrapper"],"selector":"tbody tr","type":"SelectorElement"},{"clickElementSelector":"select#mes option:contains(\"Cualquier mes\")","clickElementUniquenessType":"uniqueCSSSelector","clickType":"clickOnce","delay":1200,"discardInitialElements":"do-not-discard","id":"month-selection","multiple":true,"parentSelectors":["_root"],"selector":"html","type":"SelectorElementClick"},{"clickElementSelector":"button.btn","clickElementUniquenessType":"uniqueCSSSelector","clickType":"clickOnce","delay":1200,"discardInitialElements":"do-not-discard","id":"search-click","multiple":true,"parentSelectors":["_root"],"selector":"html","type":"SelectorElementClick"},{"delay":0,"id":"table-wrapper","multiple":true,"parentSelectors":["_root"],"selector":"table","type":"SelectorElement"}]}

Hope it helps.

1 Like

That's is spectacular! Thank you so much! Fabulous.