How to Click on the Details button Validating row data(td)

how to Click on the Details button Validating row data(td)
I want click on the Details button with validating row td data
plz help on this…
“//span[contains(text(),‘D, 07:00 - 15:00’)]/…//small[text()=‘Monday, 14 October’]/…/…/…/…//span[text()=‘E, 15:00 - 23:00’]/…//small[text()=‘Wednesday, 30 October’]/…/…/…/…//span[text()=‘Paine, Karen’]/…//small[text()=‘MICU - RN’]/…/…/…/…//span[contains(text(),‘Not Answered’)]/…/…/…/…//span[text()=‘Details’]”
I used above xpath But that is not good so plz give a solution for tha
Note:
image attached

Share the html of the element, the console error logs and the exact definition of this object on your Object Repository

2 Likes

hello,

Spy this element with Katalon Studio, if there are used numbers in

tag then you can modify it by run time creating dynamic object
1 Like

Hi @Mohamed_Sajjaath,

Could you give some more background on what you’re testing for? Are you specifically trying to click the button for the row that matches all of the values for Original Shift, Replacement Shift, Senders(s), etc., or do you just need to click the first occurrence of the Details link?

Unfortunately, the longer and more complicated the xpath, the more brittle it becomes; small changes to the layout or structure of the objects can invalidate a previously working xpath. It’s usually more reliable to assign a unique id to each element on the screen you want to interact with, and use the id to lookup the element.

When working with Katalon Studio, I recommend using the Spy Web tool, per @Timo_Kuisma’s suggestion, to create a Test Object that Katalon should be able to find. Then, if you need to swap out values dynamically, you can use Test Case Variables in the Test Object: https://docs.katalon.com/katalon-studio/docs/test-case-variables.html

Hope this helps,

Chris

1 Like

Thank you for your response
Yes I am using Test case variables and Parameterized to use dynamic xpath…
“//span[contains(text(),’${orginalShiftToRece}’)]/…//small[text()=’${orginalShiftDateToRece}’]/…/…/…/…//span[text()=’${rplcmentShiftToRece}’]/…//small[text()=’${rplcmentShiftDateToRece}’]/…/…/…/…//span[text()=’${sender}’]/…//small[text()=’${unitAndGrade}’]/…/…/…/…//span[contains(text(),’${requestStatus}’)]/…/…/…/…//span[text()=‘Details’]”

My need is I want to click Details link with validating Row data like wise I could able to select any row with validating row data…Yes as you said is correct if there are any page modification definitly that big xpath will fail…
Above dynamic xpath is working but my question is is there are any way to select a row with validating row data…? if you give the solution that will be a big help…

1. From Excel file I ll pass that 4 row data
2. if those 4 row data matching with Our Expected data > Then click on that row “Details” Link **
** (According to the Those 4 row data need to select the row Details Link)

hello,

check this page

Hi @Mohamed_Sajjaath,

So you are saying that you can select Details button in the row using that xpath and substituting the variables - is that correct? And if you change the input data to something that matches another row, it will select a different row, is that correct?

In that case, I would say that you’re already validating the row data. If you try to access the Details button in your carefully constructed xpath, the only way that step of your test will pass is if the data matches, so that’s implicitly a validation of the row data. If the Details button isn’t found for that xpath, then that would mean the data in the row doesn’t match, and that step of your test fails.

In my tests, I do very little explicit validation of objects and values on the screen. Instead, I rely on the passing or failing of the interaction with those objects to tell me whether they’re valid.

Hope this helps,

Chris

1 Like

Thank you for your replay is there are any substitute way…?

Hi @Mohamed_Sajjaath,

If you want to get the text out of the individual cells that match the entire row - but only for the row that matches all of your data, you could try building the xpath for each cell to navigate back up the document tree to get the cell, so to get the “Pending” text, you could do a full xpath something like:

“//span[contains(text(),’${orginalShiftToRece}’)]/…//small[text()=’${orginalShiftDateToRece}’]/…/…/…/…//span[text()=’${rplcmentShiftToRece}’]/…//small[text()=’${rplcmentShiftDateToRece}’]/…/…/…/…//span[text()=’${sender}’]/…//small[text()=’${unitAndGrade}’]/…/…/…/…//span[contains(text(),’${requestStatus}’)]/…/…/…/…//span[text()=‘Details’]/.../.../.../...//span”

Where the last .../.../.../...//span is added on to (hopefully) get you back to the span that holds requestStatus. Please note that without having the full page source, I don’t know if that xpath is exactly correct. You could play around with it using an online xpath evaluator.

If the xpath seems to get too complicated, you could also try other xpath functions, such as sibling or parent:

https://www.guru99.com/using-contains-sbiling-ancestor-to-find-element-in-selenium.html

If you decided to experiment with these other xpath functions, I think Appium only supports the xpath 1.0 spec currently, so check what version certain functions were introduced in.

Hope this helps,

Chris