I am new to Selenium and Katalon, which is a great product by the way.
I am currently facing a challenge I get knot out of it.
I would like to retrieve the xpath of an existing testobject in my object repository and use this xpath to call a webelement in order to manipulate a text between a span-tag (this is the qay I try, but mayby there are other solutions).
I was able to get the xpath, but because of the characters used in the path (slashes and quotes) it is not complete. This is what I have so far:
def checkBuffer = '' def xpath = '' checkBuffer = '' xpath = '' checkBuffer = WebUI.getText(findTestObject('Page_Case/formData_SiteName')) TestObject toSiteName = findTestObject('Page_Case/formData_SiteName') xpath = '//' + toSiteName.findProperty('xpath').value.replace('/', '//').replace(""", "\"") WebElement wSiteName = driver.findElement(By.xpath(xpath))
This gives me the following xpath:
/div[contains(@class, “app-wrapper”)]/div[@data-layout =“form”]/div[@data-header-text=“General”]/span[contains(@class, “app-field-SiteID”)]/span[@class=“app-control-inner app-field-data”]
Actually it should look like this:
//div[contains(@class, ‘app-wrapper’)]//div[@data-layout =‘form’]//div[@data-header-text=‘General’]//span[contains(@class, ‘app-field-SiteID’)]//span[@class=‘app-control-inner app-field-data’]
Could anybody please help me with that? I am also openminded for other solutions to change the string between span-tags.
Thanks in advance.