This is my script and below the error i get in the console:
(In this case the error is on the page - but the code is not seeing it - so the test fails)
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
CustomKeywords.‘customLogin.Login.loginIntoApplicationWith’()
WebUI.callTestCase(findTestCase(‘AddItemToCart/Cart - AddItem’), [:], FailureHandling.STOP_ON_FAILURE)
WebUI.waitForElementClickable(findTestObject(‘Checkout/ProceedToCheckOutButton’), GlobalVariable.timeout)
WebUI.click(findTestObject(‘Checkout/ProceedToCheckOutButton’))
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘Checkout/DeliverMyOrderButton’))
WebUI.click(findTestObject(‘Checkout/SelectDeliveryAddress’))
WebUI.takeScreenshot()
WebUI.waitForElementPresent(findTestObject(‘Checkout/ContinueButton’), GlobalVariable.timeout)
WebUI.click(findTestObject(‘Checkout/ContinueButton’))
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘Checkout/ContinueButton’))
WebUI.waitForElementClickable(findTestObject(‘Checkout/Donat5Button’), GlobalVariable.timeout)
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘Checkout/Donat5Button’))
CustomKeywords.‘customPaymentSelector.PaymentSelector.navigatePaymentType’(‘eBucksSpend your eBucks’)
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘Checkout/PayWithButton’))
WebUI.waitForPageLoad(GlobalVariable.timeout)
//if (WebUI.verifyElementPresent(‘eBucks/ErrorOnCheckoutAlert’, GlobalVariable.timeout) == true)
//{
// WebUI.click(findTestObject(‘Checkout/PayWithButton’))
//}
//if (WebUI.verifyElementPresent(‘eBucks/ErrorOnCheckoutAlert’, GlobalVariable.timeout, FailureHandling.OPTIONAL)== true) {
// WebUI.click(findTestObject(‘Checkout/PayWithButton’))
//}
if (WebUI.verifyTextPresent(‘An error occurred and your order was not placed. Please try again.’, false, FailureHandling.CONTINUE_ON_FAILURE)== true)
{
WebUI._click_(_findTestObject_('Checkout/PayWithButton'))
}
WebUI.setText(findTestObject(‘eBucks/RSAIDTextBox’), ‘6805550068084’)
WebUI.setText(findTestObject(‘eBucks/AccountPIN’), ‘2020’)
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘eBucks/Login’))
WebUI.verifyTextPresent(‘Pay with eBucks’, false)
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘eBucks/eBucksContinueButton’))
WebUI.takeScreenshot()
WebUI.click(findTestObject(‘eBucks/PayWithEbucks’))
titel = WebUI.getWindowTitle()
WebUI.verifyMatch(titel, ‘Checkout | eBucks’, false)
CustomKeywords.‘customLogout.Logout.LogoutAfterConfirmation’()
ERROR Log
1-12-2018 04:42:01 PM - [START] - Start action : Statement - If (com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyTextPresent(“An error occurred and your order was not placed. Please try again.”, false, CONTINUE_ON_FAILURE) == true)
11-12-2018 04:42:01 PM - [INFO] - Checking text present
11-12-2018 04:42:01 PM - [INFO] - Finding text ‘An error occurred and your order was not placed. Please try again.’ on page
11-12-2018 04:42:01 PM - [FAILED] - Text ‘An error occurred and your order was not placed. Please try again.’ is not present on page
11-12-2018 04:42:01 PM - [END] - End action : Statement - If (com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyTextPresent(“An error occurred and your order was not placed. Please try again.”, false, CONTINUE_ON_FAILURE) == true)
11-12-2018 04:42:01 PM - [START] - Start action : setText
11-12-2018 04:42:01 PM - [INFO] - Finding Test Object with id ‘Object Repository/eBucks/RSAIDTextBox’
11-12-2018 04:42:01 PM - [INFO] - Checking object
11-12-2018 04:42:01 PM - [INFO] - Checking text
11-12-2018 04:42:01 PM - [INFO] - Checking timeout
11-12-2018 04:42:01 PM - [INFO] - Finding web element with id: ‘Object Repository/eBucks/RSAIDTextBox’ located by ‘By.xpath: //input[@name=‘username’][contains(@id,‘username’)]’ in ‘30’ second(s)
11-12-2018 04:42:32 PM - [INFO] - Unable to find the element located by ‘By.xpath: //input[@name=‘username’][contains(@id,‘username’)]’. Please recheck the objects properties to make sure the desired element is located.
11-12-2018 04:42:32 PM - [INFO] - Begin finding web elements by trial and error method
11-12-2018 04:42:32 PM - [INFO] - Web element found by trial and error method is not used because we can’t guarantee it reflects the intended element. See detailed troubleshooting guide for common issues: https://docs.katalon.com/x/awXR
11-12-2018 04:42:33 PM - [FAILED] - Unable to set text ‘6809160068084’ of object ‘Object Repository/eBucks/RSAIDTextBox’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/eBucks/RSAIDTextBox’ located by ‘By.xpath: //input[@name=‘username’][contains(@id,‘username’)]’ not found)
11-12-2018 04:42:33 PM - [END] - End action : setText
11-12-2018 04:42:33 PM - [FAILED] - Test Cases/eBucksTestCases/eBucks - SuccessfullPayment FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Text ‘An error occurred and your order was not placed. Please try again.’ is not present on page
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:32)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword$_verifyTextPresent_closure1.doCall(VerifyTextPresentKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword$_verifyTextPresent_closure1.call(VerifyTextPresentKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:21)
at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword.verifyTextPresent(VerifyTextPresentKeyword.groovy:83)
at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword.execute(VerifyTextPresentKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyTextPresent(WebUiBuiltInKeywords.groovy:1677)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyTextPresent$9.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at Script1540996771538.run(Script1540996771538.groovy:63)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:183)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:108)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:294)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:285)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:264)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:256)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:200)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:99)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:90)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
at TempTestCase1542033654562.run(TempTestCase1542033654562.groovy:22)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
at groovy.lang.GroovyShell.run(GroovyShell.java:518)
at groovy.lang.GroovyShell.run(GroovyShell.java:507)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
at groovy.ui.GroovyMain.run(GroovyMain.java:384)
at groovy.ui.GroovyMain.process(GroovyMain.java:370)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
at groovy.ui.GroovyMain.main(GroovyMain.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
)