I need to find a checkbox or an image to click on to delete an entry but I cannot use a value to locate them, so xpath is not useful. I was told that CSS Selectors can be used to locate dynamically generated values. I would like to search the webpage for the table row with certain text then step down a child level and locate the checkbox or image. Each time I try and enter the CSS code in Katalon it says it cannot find the item.
The code I am entering into the Object Repository Selector Editor is:
th:contains(‘Georgetown’) > input[type=“checkbox”]
The CSS copied from the item inspection on the website is:
#BodyContent > table:nth-child(12) > tbody > tr:nth-child(2) > td:nth-child(1) > input[type=“checkbox”]
Can anyone help with the code necessary to have the test run successfully in Katalon?
Can I see your test object details?
Thanks for your response Vinh. This is the customer screenshot of offices that are closed and why. I need to be able to have Katalon choose a different checkbox than the first one (which is the easy part) and the only way I can do that in regression testing is to have it search for text. Either the office name and step down and select the checkbox or the office closed reason and find the sibling checkbox in the same row and select it. The majority of the offices are created in prior tests and not regenerated with a db refresh so each time they’re created the db assigns a higher value to be stored, so I think text is the only way to search for them going forward. The copied xpath from the inspector tool is: //*[@id=“BodyContent”]/table/tbody/tr/td/input from the above example which is the 2nd checkbox in the list below.
I found a tutorial on the Katalon site to help with working with table values: https://www.katalon.com/resources-center/tutorials/handle-web-tables/
I am now trying to make it work. I can get the code in example 2 to work to select the rows in the table but I am still trying to get the code to click on the row object to delete the row from the table.
Specially the line:
'To locate anchor in the expected value matched row to perform action'
in one example I have a checkbox that Katalon doesn't want to check on (it doesn't have a word "check" I can replace "click" with) and in another example I have an "x" image that would delete the row. When I try to add 'img' as the tagName it comes back with an error. The only tag that works is 'a' and that clicks on the name in the row not the image. Can we find the element by something other than tagName?
Also, I replaced the get(4) with get(j) as it would not run with the 4 in the brackets, hopefully this is not also causing issues.