Web Page Refresh

Hello
I want to ask about refresh web page. I have a scenario that after I click submit button, I do refresh web page while waiting for the submit button finish. I can’t do it with “WebUI.refresh()” keyword because katalon still waiting for the submit button finish first, after that run the refresh.
Anyone can help me do refresh web page while the submit button still in progress and not finish yet?

Thank you for helping before.

You could try making a class that copies the URL: url = WebUI.getUrl() and then navigates to it: WebUI.navigateToUrl(url)?

Thank you for your suggestion. I have tried it, but I can’t go to the next step like get URL because after I click button katalon still wait until finish that process (or until the page load).

how about this? it should simulate clicking F5 button

Robot robot = new Robot()
robot.keyPress(KeyEvent.VK_F5)
robot.keyRelease(KeyEvent.VK_F5)

imports needed for this one:

 import java.awt.Robot
 import java.awt.datatransfer.StringSelection
 import java.awt.event.KeyEvent
 import java.awt.Toolkit

I tried your suggestion, but still got the same situation.
Maybe the problem is katalon still waiting until the click process finish.
I am a little confused whether katalon can perform tasks simultaneously or asynchronously?

Are you using Katalon version 7.0 or newer? Maybe you have smart wait enabled

Edit 2: I tried the code below and it didn’t wait for either the page or the element to load so maybe this could help you? The first refresh was a bit slow so I thought it waits for the page to load, but it certainly doesn’t. Does this help you? You can add or remove few refreshes and change the wait times, too.

Robot robot = new Robot()
robot.keyPress(KeyEvent.VK_F5)
robot.keyRelease(KeyEvent.VK_F5)
robot.sleep(200)
robot.keyPress(KeyEvent.VK_F5)
robot.keyRelease(KeyEvent.VK_F5)
robot.sleep(500)
robot.keyPress(KeyEvent.VK_F5)
robot.keyRelease(KeyEvent.VK_F5)
robot.sleep(1000)
robot.keyPress(KeyEvent.VK_F5)
robot.keyRelease(KeyEvent.VK_F5)
robot.sleep(2000)
robot.keyPress(KeyEvent.VK_F5)
robot.keyRelease(KeyEvent.VK_F5)

I have update my katalon to the newer version to try the smart wait. But I’m still can’t refresh the page.
So my code like this :

WebUI.enableSmartWait()
WebUI.click(findTestObject('Test_Object_1))
WebUI.disableSmartWait()
WebUI.refresh()

My problem is I can’t run the refresh keyword because I’m still in the click keyword. Katalon can’t run to the next step while the previous step not finish yet.

Hmm. Don’t you need to disable SmartWait before you click? Like this:

WebUI.disableSmartWait()
WebUI.click(findTestObject('Test_Object_1))
WebUI.refresh()
WebUI.enableSmartWait()

Maybe I tell you unclear problem. I want to do refresh while after I do click and while page still load.
Without smart wait too, I still can do refresh but after all the page load. I want to do refresh while page still load.

Yeah, I understand. I’m just guessing at this point so I’m gonna stop. Hopefully someone else can answer your problem. Sorry I wasn’t of any help

No problem. Thank you so much for helping me :slight_smile:

1 Like