lundi 15 avril 2019

How fto fix "Unable to get text of Object..." in Katalon Studio?

I'm a beginner in Katalon Studio. I want to capture(store) text element and print it into console tab by using those two lines:

mac = WebUI.getText(findTestObject('Page_SMS SGT S.A. Logowanie/mac_boxa')) print(mac)

...and creating an object: "mac_boxa" is created by Copy x-path (which I believe is unique).

I get error message in logs: Unable to get text of object 'Object Repository/Page_SMS SGT S.A. Logowanie/mac_boxa'.

Can you, please advice where is the mistake? Why can't I get and print the text?


WebDriver driver = DriverFactory.getWebDriver()

WebElement Table = driver.findElement(By.xpath('//*[@id="content"]/table2'))

List lista_stb = Table.findElements(By.xpath('//a[@class="link_drive_delete"]'))

Random rnd = new Random()

WebElement losowy_box = lista_stb[rnd.nextInt(lista_stb.size())]

losowy_box.click()

//Here is the part that doesn't work:

mac = WebUI.getText(findTestObject('Page_SMS SGT S.A. Logowanie/mac_boxa'))

print(mac)

//Without theseenter image description here two lines above the code works just fine.

WebUI.selectOptionByValue(findTestObject('Page_SMS SGT S.A. Logowanie/magazyn'), '1', false)

WebUI.delay(1)

WebUI.click(findTestObject('Page_SMS SGT S.A. Logowanie/input_do magazynu_button'))

WebUI.delay(1)

Aucun commentaire:

Enregistrer un commentaire