![]()
I see your future. Youâll be paying close attention to those from now on.
![]()
I see your future. Youâll be paying close attention to those from now on.
Perfect, I see it in your video. This is exactly what weâre looking for. Ok, now for the fun part: we need to find the HTML for that overlay. Since it appears/disappears really quickly, it wont be as easy as just pressing F12 like we usually do, so hereâs a trick that will let you watch your page load step-by-step.
1.) Before setting the âcountryâ field, open your console by pressing F12 and open the Elements tab.
2.) On the <body> tag, right click and select Break on > subtree modifications:

I know this is a bit tricky, so let me know if you have trouble with the above steps.
I definitely will! But now I have a Stale element reference for a Next button and normal setText (passport Number). It even has a wait for element visible for each object. What could be causing this now? It only has one object to either input text or click a button. There is no overlay when finishing entering all passwords to click next @Brandon_Hein
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('Object Repository/Enrolment/Page_Connect - Operations - Student Enrolment/country Of Origin_SouthAfrica'), 10)
WebUI.selectOptionByValue(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_Country of Origin Drop Down'),
'1', false)
// ID Type Selection of Passport Number
WebUI.waitForElementVisible(findTestObject('Object Repository/Enrolment/Page_Connect - Operations - Student Enrolment/id Type_Passport Number'), 10)
WebUI.selectOptionByValue(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_--Select ID Type--'),
'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)
// Enters the Password
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c4'), 10)
WebUI.setEncryptedText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c4'),
'p4y+y39Ir5PEPmX20UxFKw==')
// Enters the Confirm Password
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_A digit (0-9) is required_c5'), 10)
WebUI.setEncryptedText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_A digit (0-9) is required_c5'),
'p4y+y39Ir5PEPmX20UxFKw==')
// Clicks the "Next" Button
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/button_Next'), 10)
WebUI.click(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/button_Next'))
Ok I am working on this. Do you want the HTML of the âspinning circleâ? Because there is a grey screen that appears first, and then the page loading symbol
Tell you what, I will record a video of all the screens, and send HTML of the grey screen and the loading screen. Give me a sec
Go ahead and share all of it, but in general, weâre going to look for whatever appears first. This is usually the gray overlay.
Also: I know this may seem tedious and pointless, but I guarantee you that it will pay off. If we can write a wait condition for that overlay, then put it in a custom keyword, your life will get exponentially easier.
Thank you for this!! I am currently uploading the video to my drive then will share. Whilst its doing that, do you mind having a look a bit up regarding the other stale element that I am now facing. The setText (Passport Number) and Next buttons are interchangingly throwing errors as stale elements, even though there are no global waits
Here is the link for the video:
The HTML that you see in the video (I capture 4 elements) are as follows, in order
<div class="ajaxoverlay" style="z-index: 10000002; opacity: 0.7; background-color: rgb(0, 0, 0);"></div>
<div class="ajaxoverlaymessage BorderSpin" style="z-index: 10000003; width: 30px; height: 30px; border-radius: 100%; border-left: 2px solid rgb(255, 255, 255); border-bottom: 2px solid rgb(255, 255, 255); opacity: 1; background-color: transparent;"></div>
<div class="ajaxoverlayicon" style="z-index: 10000004; width: 36px; height: 36px; border-radius: 100%; margin-top: 3px; background: url("/assets/images/InConnectLogoShort.svg") center center / contain no-repeat rgb(255, 255, 255);"></div>
<div class="ajaxoverlaymessage BorderSpin" style="z-index: 10000003; width: 30px; height: 30px; border-radius: 100%; border-left: 2px solid rgb(255, 255, 255); border-bottom: 2px solid rgb(255, 255, 255); opacity: 1; background-color: transparent;"></div>
After you set the âID Typeâ field, it appears that the overlay does appear. So my guess is that you set ID Type, then when you go to type a Passport Number and/or click Next, the page is still loading. Once we get this wait condition written, weâll just put it between all of your field sets, and it should resolve.
I have a brief meeting, but will get back to you in a few.
Thank you for all the time. You guys are a real blessing to this noob. I hope that as I learn that I can start helping people in this community. Iâm honestly loving this software and community.
Out of context kind of question: If the servers that are hosting this Universities web software is slow, will that affect the automation? As I said, yesterday my home pc and work pc ran these tests very fast, but the same scripts today are slow, and the whole day people at work were complaining that the University web software that we develop is really slow
Once you get your scripts into a state where they are as robust as possible, it shouldnât matter how fast/slow the AUT is (as long as it doesnât take more than the amount of time you specify in the âtimeoutâ argument for each of your WebUI calls, basically). It will just take some refining. But for the purpose of demoing this to your superiors, weâll get you to the right place fairly easily.
Ok so youâll need to create a new Test Object. If you need help with creating your own Test Objects just let me know, but for now Iâll assume you know how to do this.
Add the following xpath to your object:
//div[@class='ajaxoverlay']
Share a screenshot of your test object if youâd like, so we can be sure itâs configured correctly.
Then, in your script, put the following line between all of your WebUI calls for setting the fields in the form:
WebUI.waitForElementNotVisible(findTestObject('path/to/object'), 30)
Give that a shot. If it still fails, then thereâs one more thing we can add to supplement this, but lets start here.
This!
Iâll just add, even though this thread seems like itâs a mile long, whatâs being hammered out is really quite simple. WWW stands for wait wait wait. ![]()
Every move you make (researching, considering, coding, testing) needs to be meticulous. Done right, itâs easy â easy to do and easy to spot the problems. Typing out the process in a forum is tedious, lengthy and prone to misunderstanding. Like I told you elsewhere, the quality of our answers is a testament to the quality of your posts
So while itâs true that Brandon and I have the scars to prove weâre old battle-weary pros, we feel invigorated by noobs that genuinely listen and take on board whatâs being said.
Hats off to you. Keep at it.
I might as well confirm, this is correct right? And then I can get its path and call that?
Do I then put this before all the problem elements rather than the current WebUI.waitForElementVisible(...)
I will give this a shot, but if you do not mind, I will do it tomorrow (23:10 here in south africa). I really hope that we can carry on this conversation. I understand that you will probably be sleeping by the time I am able to work on this as we have many hotfixes to put into Production, but I will elequently state any further questions I have
Thank you both @Brandon_Hein and @Russ_Thomas for helping so much. I have quite often nearly given up on Katalon, but you guys are such a blessing. I cannot wait to learn more and keep at it.
Looks correct. And yes, youâll reference the path to this Test Object in your WebUI call.
Sort of. You really want to put it after any WebUI calls that cause the overlay to appear (after setting a dropdown field, for example).
Of course, weâll be around ![]()
Keep in mind, the things you are learning arenât isolated to Katalon Studio, they are fundamental skills for the whole field of test automation. I for one donât even use this tool anymore, but I learned a lot while I was.
I couldnât help myself, I added it in the beginning of my script for a few of the cases, and wouldnât you know it, this error popped up, calling the WebUI.waitForElementNotVisible(findTestObject('Object Repository/Enrolment/ajaxoverlay/ajaxoverlay'), 30) to be a stale element
My code is attached below
firstName = 'FinalError'
surname = 'TestOfTheNight1'
email = 'FinalErrorTestOfTheNight1@gmail.com'
passportNumber = 'FinalErrorTest1!'
fileLocation = 'C:\\Users\\tomgb\\OneDrive\\Pictures\\3D image 1.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('Object Repository/Enrolment/Page_Connect - Operations - Student Enrolment/country Of Origin_SouthAfrica'), 10)
WebUI.selectOptionByValue(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_Country of Origin Drop Down'),
'1', false)
// ID Type Selection of Passport Number
WebUI.waitForElementNotVisible(findTestObject('Object Repository/Enrolment/ajaxoverlay/ajaxoverlay'), 30)
WebUI.waitForElementVisible(findTestObject('Object Repository/Enrolment/Page_Connect - Operations - Student Enrolment/id Type_Passport Number'), 10)
WebUI.selectOptionByValue(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/select_--Select ID Type--'),
'2', false)
// Enters the Passport Number: This is validated, it has to be unique
WebUI.waitForElementNotVisible(findTestObject('Object Repository/Enrolment/ajaxoverlay/ajaxoverlay'), 30)
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)
// Enters the Password
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c4'), 10)
WebUI.setEncryptedText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_Valid_c4'),
'p4y+y39Ir5PEPmX20UxFKw==')
// Enters the Confirm Password
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_A digit (0-9) is required_c5'), 10)
WebUI.setEncryptedText(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/input_A digit (0-9) is required_c5'),
'p4y+y39Ir5PEPmX20UxFKw==')
// Clicks the "Next" Button
WebUI.waitForElementNotVisible(findTestObject('Object Repository/Enrolment/ajaxoverlay/ajaxoverlay'), 30)
WebUI.waitForElementVisible(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/button_Next'), 10)
WebUI.click(findTestObject('Enrolment/Page_Connect - Operations - Student Enrolment/button_Next'))
Feel free to pick this back up tomorrow, but:
Is that ajaxoverlay element present in the HTML, even when itâs not visible? If not, you can change the wait condition to WebUI.waitForElementNotPresent() instead:
WebUI.waitForElementNotPresent(findTestObject('Object Repository/Enrolment/ajaxoverlay/ajaxoverlay'), 30)
In all honesty, waitForElementNotVisible() should not throw a StaleElementReferenceException⊠that seems silly. But thatâs an issue for the Katalon Developers I suppose.
Good morning so I just had a quick look before I head out but in the HTML there is nothing with specifically class=âajaxoverlayâ. So I guess I can try that
Any updates on this? Donât want to leave you hanging.