How to get the text (case number) from Web UI

Hello,

I am trying to get the case number from WebUI using x-path and it is not working

String caseNumber = WebUI.getText(findTestObject(‘//table/tbody/tr[1]/td/p[1]/b[2]’))

pls help

Hello, I do not understand your problem. You want to find text within a table which is the casenumber. What s your goal?

As @Marek_Melocik has linked, we need more information. Namely, show us the HTML snippet in question, and exactly which element you are trying to get text from.

Thanks.

How about testing if the xpath you have gets you a singular element. Right click on the page and select Inspect. This should bring up the code window. Click inside the code window, hit CTRL + F. Copy and paste your xpath into the Find textbox (without the quotes). There should be an indicator at the end of the textbox that states, 1 of 1 or 1/1. If it doesn’t, start with improving the xpath.
Next, you may have to wait until the table is visible on the page before trying getText. Type above the getText statement, WebUI.waitForElementVisible, or other wait statement.