WebUI.maximizeWindow() doesn't work

When I run the video, it suddenly stuck at this one page and the window is not maximize which make katalon can’t detected the object. Does anyone know why this happen? I tried using the WebUI.maximizeWindow() but doesn’t seem to work. Thank You

Have you tried:

WebUI.openBrowser(’’)

WebUI.maximizeWindow()

WebUI.navigateToUrl(//yourlink)

and so on?

Have you tried:

WebUI.openBrowser(’’)

WebUI.maximizeWindow()

WebUI.navigateToUrl(//your link)

and so on?

WebUI.openBrowser(’’) : Doesn’t seem fit with the problem i’m facing

WebUI.maximizeWindow() : I tried but seem nothing happened.

WebUI.navigateToUrl(//your link) : I tried but doesn’t work. Does not navigate to the page that i want it to go

Could you please upload your script and your logs?

Thank you~

Test Cases/Latihan1 FAILED because (of) Unable to click on object ‘Object Repository/a_HOME’ (Root cause: org.openqa.selenium.ElementNotVisibleException: element not visible

WebUI.openBrowser(’’)

WebUI.maximizeWindow()

WebUI.navigateToUrl(’-’)

WebUI.delay(3)

WebUI.click(findTestObject(‘fieldset_INReport Dishonoured’))

WebUI.delay(3)

WebUI.setText(findTestObject(‘input_txtUserID’), ‘-’)

WebUI.delay(3)

WebUI.click(findTestObject(‘button_Login’))

WebUI.delay(3)

‘Accept alert after login’

WebUI.acceptAlert()

WebUI.delay(3)

WebUI.click(findTestObject(‘a_Administration’))

WebUI.delay(3)

WebUI.click(findTestObject(‘SPY-WEB/a_ACCESS CONTROL’))

WebUI.delay(3)

WebUI.click(findTestObject(‘a_User Profile’))

WebUI.delay(3)

WebUI.setText(findTestObject(‘input_UPID’), ‘secuser2’)

WebUI.delay(3)

WebUI.click(findTestObject(‘button_Search’))

WebUI.delay(3)

WebUI.scrollToElement(findTestObject(‘input_cmdBack’), 10)

WebUI.delay(3)

WebUI.click(findTestObject(‘input_cmdBack’))

WebUI.maximizeWindow()

WebUI.delay(3)

WebUI.click(findTestObject(‘a_HOME’))

WebUI.delay(3)

WebUI.click(findTestObject(‘SPY-WEB/a_secuser2’))

WebUI.delay(3)

WebUI.click(findTestObject(‘a_Sign out’))

WebUI.delay(3)

WebUI.waitForElementClickable(findTestObject(‘button_Confirm’), 5)

WebUI.click(findTestObject(‘button_Confirm’))

WebUI.closeBrowser()

The error you send it that it cannot find WebUI.click(findTestObject(‘a_HOME’)). What are you functionaly trying to do there. Are you entering a popup or are you coming from one page back to the first. Can you send screenshots about that maybe?

instead of

WebUI.delay(3)
WebUI.click(findTestObject('a_HOME'))

use

WebUI.waitForElementClickable(findTestObject('a_HOME'),5)
WebUI.click(findTestObject('a_HOME'))

dont use delay() fn …

Do I have to use the WebUI.waitForElementClickable() on the whole script or on that particular area(WebUI.click(findTestObject(‘a_HOME’))? Because i tried using it on particular area but doesn’t seem to work?

Ralph van der HOrst said:

The error you send it that it cannot find WebUI.click(findTestObject(‘a_HOME’)). What are you functionaly trying to do there. Are you entering a popup or are you coming from one page back to the first. Can you send screenshots about that maybe?

I’m from one page back to the first page. But unfortunately the window suddenly doesn’t show the menu bar and Katalon can’t find the object. I tried using the Maximizewindow() but nothing happen.

For example, the red circle that I mark is missing when I click the ‘input_cmdBack’ and navigate to the page that the menu is missing which can’t detected the object (‘a_HOME’)

listing.png

For example, the red circle that I mark is missing when I click the ‘input_cmdBack’ and navigate to the page that the menu is missing which can’t detected the object (‘a_HOME’)

does thi happend also whan you do it manualy?

Yes. I tried using manually and script

This happened when i used the scroll to element. When the page is scrolled down to element and click the input_cmdBack, it navigate to the page where the menu bar is missing

i think you found bug… if this happens also when you are using your app as user, there is no way how test can see something that is not there…
or try to use scrollToElement and as target set a_Home

Wow…It actually work. I tried using the method that you recommended. scrollToElement and as target set a_Home. It work!!! Thank you!!!

you are welcome

Andrej Podhajský said:

instead of

WebUI.delay(3)

WebUI.click(findTestObject(‘a_HOME’))


use  

WebUI.waitForElementClickable(findTestObject(‘a_HOME’),5)
WebUI.click(findTestObject(‘a_HOME’))


dont use delay() fn ... 

  

I almost forgot. Why you prefer WebUI.waitForElementClickable() than WebUI.delay(). I mean WebUI.delay() slow down a bit the process so it doesn’t speed up. What’s the difference? I’m curious

delay stops down process for precise ammount of time. usually you set that time accordingly to slowest environment you use for tests. also probably there is more than 1 delay in TC. let’s say you have 10 in one TC each will pause execution for 3 seconds - this give us 30s waiting.
waitForElement on the other hand- you are setting maximum time you want to wait - so if element shows or is ready earlier, you are good to go sooner. On fast environments you can save second here, second there. To use example from above, TC will be waiting for maximum 30s but probably less. If you save 1s on each wait you are 10s faster.
this does not seems much, but imagine complex test suites with hundereds TC when suite is running hours - you want to save time whereever you can.
so it’s good habbit to use waitFor functions. i dont say delay is not usefull, but i think twice before i use it.
just as test try to post here time it take to run test from Test Cases/Latihan1 with those delays and then time when you use waitFor functions

I see. Alright. Thank you for the explanation. It is very helpful.