How to detect a checkbox for a line and make it check using selenium from Power Automate

I’ve a line with part number , checkbox and other details.
When I pass a part number I need to select the checkbox for that line.
How to do that ?
tried like this
click xpath=//a[contains(text(),‘1024.0281’)]
check xpath=//table[@id=‘currentRowObject’]/tbody/tr[2]/td/input

But i want to do dynamically rather than hard coding part number and tr[2]

UI flow

Check
xpath=//input[@type=‘checkbox’]

how could i find the part number with 1024.0131 and check that check box for given part number

In xpath with contain you can add a part of text

you can use too starts with and ends with option in xpath

xpath=//*[starts-with(text(), 'TEXT1') and ends-with(text(), 'TEXT2')]

or you can try to find a best xpath, usually i detect the most general xpath and I switch with [1] [2] [N] in the prefered element.

1 Like

How to find xpath for part number and store it in a variable

Using contains in xpath

example
xpath=//a[contains(text(),‘1024.0’)]

This find every element contains 1024.0

i want to select that check box if that xpath contains part number

You must detect a fix part that do not change and use this in xpath or try e better xpath, need some addons to do this

xpath=//table[@id=‘currentRowObject’]/tbody/tr/td/a[text()=‘1041.9902’]//preceding:://input[@type=‘checkbox’]

I’m trying like this but it’s not selecting that part number line checkbox

Post url page and I search a good xpath for you, every element can have multiple xpath usually I choice best xpath.

Xpath must be chosed with cure.

Example multiple xpath in your username

xpaths

1 Like

url can’t be accessed outside our network :expressionless:

Each checkbox is having different id’s but how could i select exact check box based on my part number


each row is having different class name

xpath=//table[@id=‘currentRowObject’]/tbody/tr/td/a[text()=‘1041.9902’]

What is the criteria to select a checkbox ?

You must specify the exact criteria to choice a checkbox otherwise it’s impossible to detect correct checkbox.

Ui vision need to know the exact criteria to recognize an element otherwise you need to find a generic xpatch and use the number to select prefered element.

How to do this like looping through each row and if that row contains part number I’m specifying , I need to check that checkbox in that row

criteria to select checkbox is I’m passing a part number as input, it needs to find that part number existing row and select that check box

Without see the page it’s impossible to help you.

Every macro require time and study the best command.

1 Like

at least tell me how to store an xpath in a variable

What is the sense to store xpath in variable ?

You can do this with store command

https://ui.vision/rpa/docs/selenium-ide/store

Maybe this helps: