Hi all!
So I am having an odd problem. I was at work and was writing up my Katalon Script for some testing, and everything ran smoothly. I prepared the things I still had to do, and before I left, I ran my script one more time on my work laptop, and it ran perfectly. I backed up the project to my USB.
I am home now, transfer the project to my home pc, and set it to run. I didn’t change anything
Not I have an error popping up at different times!? The error is in the screenshot below. We made no changes to this part of the web software today or whilst I was on my way home. It just… broke? Why? I heard of dynamically creating objects in code, however this script is now 596 lines, and is going to be much more when its done.
I also took @Russ_Thomas’s advice and to use WebUI.waitForElementVisible for all objects to wait for it to load.
Side question: Does Katalon become slower the longer your scripts are? I noticed today at work that Katalon was running very slow compared to yesterday.
I took the advice of someone, that told me to set my “true” statements to “false” for “selectOptionByValue” which sped it up a lot, but now for some reason its so slow, on my work pc and at home (different script). Slower than usual
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 static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
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.testng.keyword.TestNGBuiltinKeywords as TestNGKW
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 com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys
import org.openqa.selenium.chrome.ChromeDriver as Keys
import org.openqa.selenium.chrome.ChromeDriver as ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions as ChromeOptions
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import org.openqa.selenium.Dimension
import org.openqa.selenium.Point
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import com.kms.katalon.core.testobject.ConditionType
firstName = 'Error'
surname = 'Test4'
email = 'ErrorTest4@gmail.com'
passportNumber = 'ErrorTest4!'
fileLocation = 'C:\\Users\\Thomas\\Pictures\\random\\random.jpg'
// open normal Chrome browser on the left side
WebDriver normalChrome = openChromeBrowserPlain()
resizeHorizontalHalfLocateLeft(normalChrome)
DriverFactory.changeWebDriver(normalChrome)
WebUI.navigateToUrl('https://inscape-operations-staging.stratusolvecloud.com/App/Student/Workflow/NewEnrolment/2022')
WebUI.waitForPageLoad(10)
// open incognito Chrome browser on the right side
ChromeOptions options = new ChromeOptions()
options.addArguments('--incognito')
WebDriver incognitoChrome = new ChromeDriver(options)
resizeHorizontalHalfLocateRight(incognitoChrome)
DriverFactory.changeWebDriver(incognitoChrome)
WebUI.navigateToUrl('https://inscape-connect-staging.stratusolvecloud.com/UserManagement/login/')
WebUI.waitForPageLoad(10)
WebUI.delay(2)
DriverFactory.changeWebDriver(normalChrome)
// Basic Personal Information Step
// Maximizes the Window
//WebUI.maximizeWindow()
// Enters the First Name
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Welcome to INCONNECT - our online stu_0eecac'), 10)
WebUI.setText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Welcome to INCONNECT - our online stu_0eecac'),
firstName)
// Enters the Last Name
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Welcome to INCONNECT - our online stu_d2ddfb'), 10)
WebUI.setText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Welcome to INCONNECT - our online stu_d2ddfb'),
surname)
// Enters the Cell Phone Number: This is not validated, so it can always be the same
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_land Islands_cell'), 10)
WebUI.setText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_land Islands_cell'),
'0790000000')
// Enters the Email Address: This is validated, it has to be unique
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c3'), 10)
WebUI.setText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c3'),
email)
// Country of Origin Selection of South Africa
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_Country of OriginSouth AfricaUnited _72b9c5'), 10)
WebUI.selectOptionByValue(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_Country of OriginSouth AfricaUnited _72b9c5'),
'1', false)
// ID Type Selection of Passport Number
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_--Select ID Type--RSA ID NumberPassp_e4a2f7'), 10)
WebUI.selectOptionByValue(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_--Select ID Type--RSA ID NumberPassp_e4a2f7'),
'2', false)
// Enters the Passport Number: This is validated, it has to be unique
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c7'), 10)
WebUI.setText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c7'),
passportNumber)