Please help me with this:
Received the following error when I executed automated Test Cases;
Test Cases/Online Order FAILED because (of) Unable to switch to iframe (Root cause: java.lang.NullPointerException)
Error is received in the following line:
WebUI.setText(findTestObject(‘Page_/input_EWAY_CARDNUMBER’), ‘3777 000000 00000’)
Following is the code I have been using:
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.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
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.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
WebUI.openBrowser(‘’)
WebUI.navigateToUrl(‘http://giftweb-sit.ad.scentregroup.com/RPortal’)
WebUI.click(findTestObject(‘Page_Buy Westfield Gift Cards Onlin/a_Buy Now’))
WebUI.click(findTestObject(‘Page_Buy Gift Cards Online Westfie/button_Add to cart’))
WebUI.click(findTestObject(‘Page_Buy Gift Cards Online Westfie/li_50’))
WebUI.click(findTestObject(‘Page_Buy Gift Cards Online Westfie/div_Go back’))
WebUI.setText(findTestObject(‘Page_Buy Gift Cards Online Westfie/input_Value’), ‘70’)
WebUI.setText(findTestObject(‘Page_Buy Gift Cards Online Westfie/input_Quantity’), ‘1’)
WebUI.click(findTestObject(‘Page_Buy Gift Cards Online Westfie/button_Add to Cart (1)’))
WebUI.click(findTestObject(‘Page_/input_ContactType’))
WebUI.setText(findTestObject(‘Page_/input_ActivationCommunicationT’), ‘swapnareddyj@gmail.com’)
WebUI.setText(findTestObject(‘Page_/input_ActivationCommunicationT_1’), ‘swapnareddyj@gmail.com’)
WebUI.click(findTestObject(‘Page_/button_Proceed to Checkout’))
WebUI.setText(findTestObject(‘Page_/input_BillingAddress.FirstName’), ‘swapna’)
WebUI.setText(findTestObject(‘Page_/input_BillingAddress.LastName’), ‘reddy’)
WebUI.setText(findTestObject(‘Page_/input_BillingAddress.StreetAdd’), ‘targo road’)
WebUI.setText(findTestObject(‘Page_/input_BillingAddress.Suburb’), ‘girraween’)
WebUI.selectOptionByValue(findTestObject(‘Page_/select_SelectNSWACTNTQLDSATASV’), ‘NSW’, true)
WebUI.setText(findTestObject(‘Page_/input_BillingAddress.PostCode’), ‘2145’)
WebUI.setText(findTestObject(‘Page_/input_EmailAddress’), ‘swapnareddyj@gmail.com’)
WebUI.setText(findTestObject(‘Page_/input_Phone’), ‘123456’)
WebUI.click(findTestObject(‘Page_/span_Next’))
WebUI.click(findTestObject(‘Page_/input_PaymentType’))
WebUI.click(findTestObject(‘Page_/input_AcceptTermsAndConditions’))
WebUI.click(findTestObject(‘Page_/button_Place order’))
WebUI.switchToFrame(findTestObject(‘Page/_ifr_EWAY_CARDNUMBER’), 5)
WebUI.setText(findTestObject(‘Page_/input_EWAY_CARDNUMBER’), ‘3777 000000 00000’)
WebUI.click(findTestObject(‘Page_/div_id(katalon-elementInfoDiv)’))
WebUI.setText(findTestObject(‘Page_/input_EWAY_CARDNAME’), ‘test’)
WebUI.selectOptionByValue(findTestObject(‘Page_/select_Month’), ‘11’, true)
WebUI.setText(findTestObject(‘Page_/input_EWAY_CARDCVN’), ‘100’)
WebUI.click(findTestObject(‘Page_/span_Pay now’))
WebUI.closeBrowser()