Match Data from Spreadsheet to Search Results in Table, Click Correct one

Sadly I had already switched the xpath to “xpath”.

I’ve changed the thing you changed which is to remove my extra + needed to get the ’ around the names… but that doesn’t help. I had a way to do that, and while more complex, your method just cleans up the code and it changes it from ‘Bruce’ to “Bruce” being displayed in the error message so it’s not placing single ’ it’s placing the " around the name. Unless i missed something else, i don’t see a difference.

Mine now with your " added in:

selectNameObj.addProperty(“xpath”, ConditionType.EQUALS, ‘//*[@id=“search_results_container”]/div/div/div/div[2]/a/h4/text()[contains(., " ’ + firstName + ’ " ) and contains(.," ’ + lastName + ’ ")]’)

/parent can’t be added at the end like that the IDE throws an x on that line stating the /parent:: portion is wrong because it’s outside the xpath quote. Unless i move the /parent inside the ’ like so:

selectNameObj.addProperty(“xpath”, ConditionType.EQUALS, ‘//*[@id=“search_results_container”]/div/div/div/div[2]/a/h4/text()[contains(., " ’ + firstName + ’ " ) and contains(.," ’ + lastName + ’ ")]/parrent::h4’)

I’m wondering if we need to put the xpath into a variable and then pass the variable over to the ConditionType, i noticed in some searching no one had the xpath directly after, they all had it in a variable but not sure if that helps in anyway outside of making it than a single variable or how it all works.

I do know text is the biggest thing i need for my website and if Katalon can’t search text that is going to be a major issue. I took a screencap of the code so you could see how the IDE colors it in case something might be off. Like the word “and” counts as a word it seems instead of a keyword, but i’m unsure if that’s normal since we are encapsulating the entire xpath.

Current error: This error is same if /parent::h4 is added into the code like above.

04-10-2019 11:49:46 AM Test Cases/Create WOs

Elapsed time: 1m - 45.639s

Test Cases/Create WOs FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘objectName’ located by ‘By.xpath: //*[@id=“search_results_container”]/div/div/div/div[2]/a/h4/text()[contains(., “Bruce” ) and contains(.,“Willis”)]’ not found
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:32)

Lets see if i have a link for what i was looking off of last night: addProperty('xpath' ...) with String as xpath? - #17 by lukas_krombholz

This one is doing some stuff diff than what I need, but it seems they are passing the xpath to a variable with variables being passed as well. I’m not sure if the detail2 and attribute is moved over.

Specifically i’m looking part way down at this chunk of code:

//TestObject to = findTestObject(‘bm/color/colorname’)
//String prop = “//*[@class = '”+detail2+“‘]//h4[contains(text(),’”+attribute+“')]”
//to.addProperty(‘xpath’, ConditionType.EQUALS, prop, true)

Thanks again for sticking around B_L and trying to help me solve this bugger. Once we can get this text thing sorted i should be zipping along as it all depends on reading text, once that hurdle is out of the way i’m sure i’ll find a new one but that seems to be the big one for this test case.