I’m experiencing issues with unstable selectors when trying to extract data from the Farmacias Galeno website (https://farmaciasgaleno.com.gt/). The main problem is that the selectors change dynamically when searching for different medications, causing UiPath to fail when trying to locate elements.
Website Interface and Behavior
The webpage does not display all information immediately; I need to scroll down to view prices, stock, and pharmacy details.
The structure of the page shifts depending on the medication searched. For example, the position of the pharmacy name, price, and stock information may appear at different heights or locations in the DOM.
When testing with a specific medicine, the automation works. However, when searching for a different medication, the selectors break, and UiPath throws errors like:
“Get Attribute ‘FARMACIAS GALENO’: Multiple similar matches found.”
“Find Element ‘B’: Activity timeout exceeded.”
Solutions I Have Tried
I have attempted several strategies to make the selectors more stable:
Dynamic Selectors
I tried making the selectors dynamic by using wildcards (* and ?), but they still break when changing medications.
Anchor Base
I tried using Anchor Base to find elements relative to a fixed label (like “Pharmacy” or “Price”), but the layout changes prevent consistent detection.
Find Children
I attempted to use Find Children to retrieve all similar elements and filter the correct one, but the structure changes in different searches, making it difficult to extract reliable data.
OCR and Text Recognition
I attempted to extract the data using Get OCR Text, but the text formatting makes it difficult to extract structured information.
What I Need Help With
I need a reliable way to extract pharmacy details, stock availability, and price from this website, considering that: The page structure shifts depending on the medication. The data is not always visible at first (requires scrolling). The selectors change dynamically, breaking the automation.
Any guidance on handling this situation effectively in UiPath would be greatly appreciated!
What details are you trying to fetch?
The one on the left, or right? If it is the Product details on the rigjt (as per your screenshot), I am not able to see those details. I waited for the page to load, and I’ve scrolled.
I assume that this website is specific to your country, or it has restricted me from seeing the details.
I have inspected the page and found the element you wish to fetch the details from, but it does not hold any value. (Refer below Screenshot)
I don’t think I can help you with the selectors if there is nothing to select. Might have to wait for an MVP or another community member who can actually see the details.
Thanks for this critical info.
I tried to build the process with 5 products and found out that the “eye” button plays a key role on the “visibility” of the details.
Explanation:
When I open the link on the browser for the first time, the details are not visible (Like Yesterday).
I search for a medicine and click the “eye”, the details will be visible. But there is a catch.
The Website will display the details of only 1 medicine at a time. Example: I clicked the visibility for “Paracetamol”. You can see below, the details are visible but if I search for “Montelukast” (using URL), it will have the details of “Paracetamol”. This means that “URL based search” is not possible.
Based on the type of medicine, the details will be visible. (Because medicines could be fluid, tablet, capsule, injection, etc and hence the details will also vary. For Example, some medicines strictly require Prescriptions, hence this detail will not be present on all medicines). I have selected 5 different medicines to demonstrate the same.
What Did I Do ?
Use “Check App State”, to check whether medicine Code (detailcode) is visible. I have done the following under the “Target appears” sequence.
Use “Get Attribute” activity for each of the data you wish to extract.
– Set “Continue On Error” to True. (if the detail is not present for that medicine)
– Set “Timeout” to 2.
– Attribute being fetched “visibleInnerText”.
– In the “Get Attribute” use Strict selectors Only. Use the “id” of the element (As shown in my excel column headers Or in my previous reply regarding inspect code)
I have implemented your solution in my flow and it has worked perfectly for me. Now I can extract the data of various medications. I really appreciate the time you took to help me.
Thank you so much