MissingPropertyException: No such property: WebUI for class: Script1565360737573

Hi,

This is my code :

import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.remote.server.DriverFactory

WebUI.openBrowser(’’)
WebUI.navigateToUrl(‘https://www.pagesjaunes.fr/’)
WebUI.setText(findTestObject(‘PJ/1_Page_Accueil/1_TF_input_quoi qui _quoiqui’), ‘architecte’)
WebUI.setText(findTestObject(‘PJ/1_Page_Accueil/2_TF_input_o _ou’), ‘ile-de-france’)
WebUI.click(findTestObject(‘PJ/1_Page_Accueil/3_Loupe_i_A proximit_icon icon-search’))
//WebUI.click(findTestObject(‘PJ/2_Page_Resultat_Recherche/a_E-Mail’))

//Cliquer sur le 1er Btn Email, 2ème Btn EMAIL
WebDriver driver = DriverFactory.getWebDriver()
List buttons = driver.findElements(By.xpath(’//a[@title=‘E-Mail’]’))

a = buttons.size()
println("Number Of Email Object in this Page: "+a)

for (def i=0; i<buttons.size(); i++){
println("Loop n° "+i)
buttons.get(i).click()

//On rempli le formulaire et on envoie
//WebUI.waitForElementVisible(findTestObject('PJ/3_Page_Formulaire/1_TF _Nom'), 5)

WebUI.setText(findTestObject('PJ/3_Page_Formulaire/1_TF _Nom'),'oukna')

//WebUI.click(findTestObject('PJ/3_Page_Formulaire/6_BTN_EnvoyerMSG'))
WebUI.click(findTestObject('PJ/3_Page_Formulaire/X_i_Fermer_icon icon-fermer'))
//WebUI.rightClick(findTestObject('PJ/3_Page_Formulaire/7_Libelle_CB_Merci votre message a bien t envoy'))
//WebUI.click(findTestObject('PJ/4_Page_Prospect/1_NomEntreprise_h1'))
WebUI.click(findTestObject('PJ/3_Page_Formulaire/8_span_Retour aux rsultats'))
//WebUI.closeBrowser()

}

I Have this error message :

08-09-2019 04:33:38 PM Test Cases/New Test Case

Elapsed time: 0,316s

Test Cases/New Test Case FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: WebUI for class: Script1565360737573
at New Test Case.run(New Test Case:6)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1565364816677.run(TempTestCase1565364816677.groovy:21)

Hi,
Add

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
3 Likes

Merci HeleneB