I have script in Groovy which is filling input fields in form in web app. It is working good but I have combobox where my script must
- Enter text from excel file - and it is working
- Click on span or div with text, which appears below input field after filling it - in other case when it clicks on next object the filled text disappear.
I want to have that kind of logic:
- If you find string - put the text in input
- But if you find combobox put the text in it and click on field which appears below, if it is span
- In other case when the field is div, click on div.
//THIS VARIABLE WORKS OK
Obiekt = WebUI.modifyObjectProperty(findTestObject('Empty/SENCHATEST_empty'), 'xpath', 'null', ('//div[@senchatest=\'' +
SENCHATEST) + '\']//input', true)
//THIS TWO DO NOT WORK
comboSpanClick = WebUI.modifyObjectProperty(findTestObject('Empty/span_empty'), 'xpath', 'null', ('//span[(text() = ' +
fieldText) + ')]', true)
comboDivClick = WebUI.modifyObjectProperty(findTestObject('Empty/div_empty'), 'xpath', 'null', ('//div[(text() = ' +
fieldText) + ')]', true)
//THIS PART IS WORKING (THERE ARE VARIABLES FROM EXCEL FILE)
WebUI.waitForElementClickable(Obiekt, 10)
if (fieldType == 'string') {
WebUI.click(Obiekt)
WebUI.setText(Obiekt, fieldText)
}
if (fieldType == 'number') {
WebUI.click(Obiekt)
WebUI.setText(Obiekt, fieldText)
}
if (fieldType == 'date') {
WebUI.click(Obiekt)
WebUI.setText(Obiekt, fieldText)
}
if (fieldType == 'combo') {
WebUI.click(Obiekt)
WebUI.setText(Obiekt, fieldText)
WebUI.delay(2)
}
//AND THE SCRIPT STOPS WORKING HERE
else if (WebUI.waitForElementClickable(comboSpanClick, 10))
WebUI.click(comboSpanClick)
elif (WebUI.waitForElementClickable(comboDivClick, 10)) {
WebUI.click(comboDivClick)
}