Dynamic selector to be set to click the right text value in the table which is in portal

Hi,

I have a situation here, in a portal, there is a table, which consist of multiple rows, it can three, four or even two some times. I search with a particular child name, but as there are sibilings for them, all of their information gets listed, all i wanted is to click on the respective child name.

here is the flow

enter child last name and first name and hit search

click on child info tab to see the list of the child’s

now multiple child information gets listed, respective child name which i entered in the beginning to search should be clicked. attached reference screenshot

First row

@Ayesha_Ijaz,

Get the selector of the Ui Element using Ui Explorer and check with attribute have the desired name value.

Once you figure out this, then make it dynamic by removing that hardcoded name with a variable.

Thanks,
Ashok :slight_smile:

SyntaxEditor Code Snippet

here is the selector.

I hold variable which enters last name and first name to search and Name gets listed like below in the table. suppose if i need to click on the last one, how do i do it, here is the selector information.

I have attempted to set one, based on your suggestion, maybe i did not get it right could you check on it

image

The image shows a Selector Editor window for the "FMS - Family Center" application running in Chrome, with an error indicating that the variables or arguments "lastname" and "firstname" are not defined in the current scope. (Captioned by AI)

@Ayesha_Ijaz

You can try as below:

After Data Scraping, iterate through the DataTable
For Each row In childDataTable.Rows

Assuming the child's name is in the first column (Index 0)
If row(0).ToString.Equals(childName, StringComparison.InvariantCultureIgnoreCase) Then

Construct the selector dynamically (adjust the selector as needed)
childSelector As String = “” & _

” & _
“” & _
“”

     Using Click activity with dynamic selector
    Click activity
        Selector: childSelector
    End Click
    
    Exit the loop once the child is found and clicked
    Exit For
End If

Next

” & row(0).ToString & “

@Ayesha_Ijaz,

Remove the tableRow='2' attribute and try.

Hi Ashok, for some reason, still there is an error

variable or argument lastname is not defined in the current scope but i have already declared it.

The image shows the "Edit Selector" window for a web control in an automation tool, indicating that the variables "lastname" and "firstname" are not defined in the current scope. (Captioned by AI)

let me know your availability for a quick connect ?

@Ayesha_Ijaz,

Remove from here as well and try

The problem was with adding the variables in the selector. You can add the variables by cutting down the selector string with like this “+varname+”.

Please mark this as a solution if it worked for you :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.