Element exist on report search result

Hi All,

I am currently using Uipath for some checking in browser according to the excel file.
What I need to do is when there is a result of the search then click on the report, if no report found then continue for next line checking.

I am using “Element Exist” to check whether there is report or not which it return a boolean and continue with my “IF Function”. But the report name is everytime different and “Element exist” seems not working. and the click on report is not working also. Not sure is it the report name is not the same everytime?

Below is the report search browser page.

Below is my flow in Uipath for this.

Can anyone guide me on this? I have try out many times but it works for sometimes but not everytime…

Thanks.

Regards,
Jacelyn Lok

Hi @JacelynLok08

You need to set the selector for the report name dynamically.
How to do that? Please watch this video:

Best regards
Mahmoud

1 Like

Hi @JacelynLok08

Can you send me your screenshot of the selector that you re using for elements exists in Ui Explorer?

Regards

Hi Pravin,

Here is the screenshot of Element exist in Ui Explorer.

Hi can u check whether aaname or any other attribute had the name of record

If yes use in selector

Or another way is to use css selector

Hi Nived,

Can you guide me further on how to make the changes in aaname/css selector?

Thanks.

Hi @JacelynLok08
can u show the html structure of page [Specific to position where record name is there] and as well as aaname attribute as well?

Regards,
Nived N

Hi Nived,

Below is the screenshot of the page.
When there is supplier report exist and match it will shown as below.

and when there is no match report exist it will show as below with “No matches Found”.
I am using element exist to detect it. Not sure can make it this way? or there is other way which is better on it, you may suggest to me as well.

For aaname there is blank in UiExplorer

Thanks.

Regards,
Jacelyn

Hi @JacelynLok08

Can u share the html structure of the webpage by right clicking the web page and click inspect

Then highlight the report name part in the html element

Hi Nived,

Below is the html that i copy from the website as per your guide.
Let me know if it is not the thing that you looking for.

        <table class="screening-alerts-table tablesorter" id="example">
          <thead>
            <tr>
              <th class="company-header" sortby="name">
				<div class="watchlistFolder">
					<select class="sortlist" id="searchSortList" aria-disabled="false" style="display: none;">
									<option value="companyName">Company Name</option>
									<option value="address">Street Address</option>
									<option value="city">City</option>			
									<option value="state">State</option>
																
					</select><span><a class="ui-selectmenu ui-widget ui-state-default ui-corner-all ui-selectmenu-dropdown" id="searchSortList-button" role="button" href="#nogo" tabindex="0" aria-haspopup="true" aria-owns="searchSortList-menu" aria-disabled="false" style="width: 121px;"><span class="ui-selectmenu-status">Company Name</span><span class="ui-selectmenu-icon ui-icon ui-icon-triangle-1-s"></span></a></span>
					
				</div>
				<span class="sort-fields"> <span class="sort-default" sort="desc"></span> </span>
			  </th>
              <th class="duns-header" sortby="dunsNumber">D-U-N-S
              <span class="sort-fields"> <span class="sort-default" sort="desc"></span> </span>
              </th>
              <th class="type-header" sortby="locationType">Type
              <span class="sort-fields"> <span class="sort-default" sort="desc"></span> </span>
              </th>
              <th class="siccode-header" sortby="lineOfBusiness">SIC Description
              <span class="sort-fields"> <span class="sort-default" sort="desc"></span> </span>
              </th>
              <th class="expand-header">Expand</th>
            </tr>
          </thead>
          <tbody id="search-results">
           <tr id="0">  <td>       <span style="float: right;">        <span style="margin: 0px 5px;"><img title="Supplier Folder" alt="Supplier Folder" src="static/images/SupplierBase.png"></span>               </span>               <h4><a href="supplierProfile?compName=Peninsula Components, Inc.&amp;dunsNumber=60-613-7065" onclick="return loadSuppProfile(this);" clickcount="0">Peninsula Components, Inc.</a></h4>              <span class="cmp-address">1300 Industrial Rd Ste 21,San Carlos, California</span>      </td>                        <td>60-613-7065</td>                    <td>Headquarters</td>                    <td>Electronic parts</td>            <td class="center"><img src="static/images/expandClose.png" class="srch" id="60-613-7065Expand"><img src="static/images/ajaxLoader_small.gif" id="60-613-7065Load" style="display: none;"></td>        </tr> <tr class="details-row" style="display: none;"> <td class="details" colspan="5">                    <div class="detailsList1">                          <div class="company_details">                                <span class="cmp-group1" style="width:100%;">         <li style="width:35%;float:left;">                                      <span class="cmp-sales">             <span class="sales-label">Country/Region:</span><span class="sales-label" id="60-613-7065Country">USA</span>                                      </span>            <span class="cmp-sales">                                                                                  <span class="sales-label">Phone:</span><span class="sales-label">650-593-3288</span>                                                                           </span>            <span class="cmp-sales">            <span class="sales-label">Website:</span><span class="sales-label" id="60-613-7065Url"><a href="#">N/A</a></span>                                       </span>         </li> <li style="width:63%;float:right;" id="60-613-7065NationalBusiness">  </li>             <div style="clear:both;"></div>         </span>         <span class="cmp-group2">          <span class="cmp-sales">                      <span class="annualSales-label">Annual Sales:</span><span id="60-613-7065annualSales" class="sales-value">NA</span>                     </span>          <span class="emp-total">           <span class="emp-label">Employee Total:</span><span id="60-613-7065employeeTotal" class="emp-value">481</span>          </span>         </span>         <span class="cmp-group3">          <span class="cmp-updated"><img id="dateWarning60-613-7065" style="margin-right:5px" src="static/images/warning.png" alt="warning" title="warning"><span id="60-613-7065UpdateDate">Not Modified</span></span>                             <span id="dateWarningMsg60-613-7065" class="cmp-profile-score"><a href="supplierProfile?dunsNumber=60-613-7065" onclick="return loadSuppProfile(this);" clickcount="0">Go To Company Profile Page to Update/Add to Watchlist Folder</a></span>                    </span>         </div>        <div class="company_ratings">         <div class="scoreblock">          <div class="col1">                   <ul>          <li style="height:20px"><span class="Nmae_l"> SER</span></li>                   <div id="SERSlider0" class="CmpSerSliderContainer" style="border: none;">Not Available</div>          </ul>         </div>          <div class="col2">          <ul>          <li style="height:20px"><span class="Nmae_l"> Paydex</span></li>                   <div id="PaydexSlider0" class="CmpPdexSliderContainer" style="border: none;">Not Available</div>          </ul>          </div>                   </div>         <div class="scoreblock1">          <div class="col1">          <ul>          <li style="height:20px"><span class="Nmae_l"> SSI</span></li>                   <div id="SSISlider0" class="CmpSsiSliderContainer" style="border: none;">Not Available</div>          </ul>          </div>          <div class="col2"><ul>          <li style="height:30px"><span class="Nmae_l">Overall Rating</span></li>          <span>           <ul id="searchstart0" class="CmpOverallRatingContainer">Not Available</ul>          </span>          </ul></div>                   </div>       <div class="scoreblock1">         <div id="viabilityScore0" class="col3 viabilityScoreContainer"><ul><li style="height:20px"><span class="Nmae_l"> Viability Rating</span></li><li style="margin-top: 10px;"><span>Not Available</span></li></ul></div>         <div class="col3"> <ul>          <li style="height:20px"><span class="Nmae_l"> Scorecard Risk</span></li>          <li style="color: red; margin-top: 10px; text-align: center"><span id="60-613-7065ScrCadRsk"></span></li>          </ul>         </div>       </div>        </div>                             <div class="company_diversity">         <div class="diversity-block">          <h2>Supplier Diversity</h2>          <div class="diversity-row">           <div class="diversity-label">MIN (US)</div><div class="diversity-value" id="60-613-7065Min">No</div>          </div>          <div class="diversity-row">           <div class="diversity-label">WOMEN</div><div class="diversity-value" id="60-613-7065Wom">No</div>          </div>          <div class="diversity-row">           <div class="diversity-label">VET (US)</div><div class="diversity-value" id="60-613-7065Vet">No</div>          </div>          <div class="diversity-row">           <div class="diversity-label">SBA (US)</div><div class="diversity-value" id="60-613-7065Sba">No</div>          </div>          <div class="diversity-row">           <div class="diversity-label">GREEN</div><div class="diversity-value" id="60-613-7065Grn">No</div>          </div>          <div class="diversity-row">           <div class="diversity-label">ACDBE (US)</div><div class="diversity-value" id="60-613-7065Acd">NA</div>          </div>          <!--<div _tmplitem="1"  class="diversity-row">           <div _tmplitem="1"  class="diversity-label">GLBT</div><div _tmplitem="1"  class="diversity-value" id='60-613-7065Glb'>No</div>          </div>--><br>          <div class="diversity-row">           <div class="diversity-label">SME Class</div><div class="diversity-value" id="60-613-7065Sme">NA</div>          </div>         </div>        </div>                         </div>  </td>   <td style="display:none" class="scoreDetails">                    <span class="serSliderId" id="60-613-7065SerIndex">SERSlider0</span>                    <span class="paydexSliderId" id="60-613-7065paydexIndex">PaydexSlider0</span>                    <span class="ssiSliderId" id="60-613-7065ssiIndex">SSISlider0</span>                <span class="serVal" id="60-613-7065Ser"></span>          <span class="paydexVal" id="60-613-7065Paydex"></span>          <span class="ssiVal" id="60-613-7065Ssi"></span>       <span class="overallRating" id="60-613-7065OvrallRtng"></span>       <span class="viabilityScore" id="60-613-7065ViabltyScr"></span>                   <span class="overallRt" id="60-613-7065RatingIndex">searchstart0</span>                   <span class="viabilitySc" id="60-613-7065viabilityIndex">viabilityScore0</span>            </td> </tr></tbody>
        </table>
     </div>

Thanks.

Regards,
Jacelyn

Well after opening the inspect element

Just try to right click on the report name and then select inspect again, it will highlight the report html part

Just take the screenshot of that and paste here

Well I looking for the scope of writing the css selector for it if possible

Regards

Nived N :robot:

Hi Nived,

Okay, I have do as per your guide. Below is the screenshot of the aspect.

aspect

Thanks.

Regards,
Jacelyn

Hi @JacelynLok08
What u can is these 2 methods

  1. DataScrapping process

After clicking on search button, you will get the table of different reports matching the name.
Now u can use Datascrapping to scrap the report name and URL associated with report name and store in datatable.

Then u can manipulate through your datatable by filtering the report name with report name u need and select the URL correspondly to it so that u can get to open the link instead of clicking s to try on report.

OR

  1. second way u can try is to try the element exists method with dynamic selector approach
"<html app='chrome.exe' title='Supplier Risk Manager'/><webctrl tag='TABLE'/><webctrl tag='TD' href='supplierProfile?compName="+reportname+".&dunsNumber=*"

Put this selector in element exists activity. reportname is the variable which contains the name of report that u are checking…

Please check both ways and let me know whether it works or not

Regards,
Nived N

Hi Nived,

the 1st option DataScrapping Process is not suitable as i am inserting address and zip code of the company to get the correct report.
Hence, it might shown out a few report but all with same supplier name. But i will only want to select the 1st report.

For option 2, I have try to assign the company name as “SupplierName”.

And i have indicate the code into the selector part but it shown error as below:

Can you please help to see whether for option 2 is it ok on the code that I have insert?

Thanks.

Regards,
Jacelyn

Thanks Mahmoud for the sharing. But I am new to Uipath hence i didn’t know how to change the selector for the report name. Not sure can you guide on this?

Regards,
Jacelyn

Hi @JacelynLok08

For the first option , datascrapping seems to be possible, as the first u search the required reports by zip and company name and then table appears, then use the datascrapping to entire table. Now u can select the first row by dt1.Rows(0)(columnname)

For the second option, can u try like this

"<html app='chrome.exe' title='Supplier Risk Manager'/><webctrl css-selector='a[href*='"+reportname+"']'/>"

Let me know if it works for you

Regards,
Nived N

Hi Nived,

There is still showing Syntax error for the code you provided as below.

Syntax

For data scrapping option, can you have a sample for me? I have no idea how can I do this.
As i find from activity there is no datascrapping option to add on.

Thanks.

Regards,
Jacelyn Lok

Hi @JacelynLok08

Sorry

Just edited thr selector in above response

Please check that

Hi Nived,

It still showing error.

Regards,
Jacelyn Lok

Hi @JacelynLok08
May be there is small issue

"<html app='chrome.exe' title='Supplier Risk Manager'/><webctrl css-selector='a[href*="+reportname+"]'/>"

check this