I am trying to get data from a website and after successfully doing a query (1. Enter the value in a box and 2. click on search),
I get the results.
When I try to use Get Text it throws a multiple occurrences error. On inspection, the following structure is shown in the browser.
DATA
DATAR
DATAR
DATAR
and it repeats again.
each of the
value is selectable and gives green, but after selection the multiple existence error is shown.
My question is can we get DATA from class=“src” based on a substring?
Also, how to select all the
DATAR values and save to excel.
The structure is not a table in the website.
Thanks in advance for lending a helping hand. Also, as this is my first post, please help correcting if there are any errors.
Hey @sriram.nadiminti so you are extracting values from a website that you pin in the post right can you highlight where are you getting the value and is it a single value or a table format value? and after extracting are you storing this data on excel
Hi @singh_sumit Thank you for the reply. This is a intranet web-site.
My problem is that the number of lines that appear every time is varying in number. The max being 45 html li’s.
It is in a for each row of excel where it reads from the sheet, enters in the designated area in web-page, waits for the page to load with data. Then I make it to read from web-page using get text and write back to excel in the same row. The web page response is perfect with html lines in a dt dl mode.
The fuzzy selector always selects differently and the strict selector with idx control is a shown below.
SyntaxEditor Code Snippet
html app=‘firefox.exe’ title=‘viewpage’
webctrl idx=‘2’ isleaf=‘1’ parentid=‘content’ tag=‘LI’
After getting the result I’m saving it to Excel by collecting all variables, which is working perfectly for the page with 45 entries.
For lesser number, it fails at the n+1 entry - though there is a continue on error checked in the GetText. how to put a proper check to go to next read from excel and enter for the next page loop.
@sriram.nadiminti can you put your get text activity in a try catch. and in the catch bot simply use a log to catch exception so it can continue without causing any exception.
Since you’re dealing with variable numbers of LI elements, you could first check the total number of LI elements on the page using Find Children. This will give you the actual count of LI elements.
Find Children activity with:
Tag: LI
Scope: Web
Output: childrenList (List of UiElement)
If childrenList.Count > 0
For Each li in childrenList
// Extract text from each li and write to Excel
End If
Thank you. I am trying to get the childrenList and receiving a message like below after saving the output to a variable and put it to messagebox with .ToString.
UiPath.core.UiElement
For reference the structure is as below
<dl class="MEC">
<dt><span class="myclass">INPUTTEXT</span> <img alt="Report error(s)" title="Report error(s)" src="img/error.jpg" border="0" onclick="RptError(this,"INPUTTEXT",10)"> <a href="SN_Intro_Abbr.html" title="Abb for the Works" target="_blank">Details</a></dt>
<dd><span class="cf"> </span><br><ul><li>RESULT1</li></ul></dd>
<dt><span class="myclass">INPUTTEXT</span> <img alt="Report error(s)" title="Report error(s)" src="img/error.jpg" border="0" onclick="RptError(this,"INPUTTEXT",34)"></dt>
<dd><ul><li><span class="cf">type1</span>RESULT2</li></ul></dd>
<dt><span class="myclass">INPUTTEXT</span> <img alt="Report error(s)" title="Report error(s)" src="img/error.jpg" border="0" onclick="RptError(this,"INPUTTEXT",48)"></dt>
<dd><br><ul><li>RESULT3</li><li>RESULT4</li><li>RESULT5</li></ul><br><ul><li>RESULT6</li><li>RESULT7</li><li>RESULT8</li><li>RESULT9</li><li>RESULT10</li></ul></dd>
</dl>
Another <dl> which will have further results
Sorry to have edited so many times. I was masking the original text for our internal procedures.
I am interested in getting the RESULT1, RESULT2 etc from this page.
Can you please help write the code and give me an image file.