Katalon always focuses the browser's address bar

Hi!

After upgrading to Katalon 10.1.1. from 9.7.6. for every test I start Katalon focuses the browser’s address bar at the top.

This is no issue in most tests, but I have a few tests where I enter some sort of barcode via sendKey and submit via ENTER. The browser then just goes to whatever I “typed” into the address bar via google search and gives me the “are you a robot” warning.

I tried focusing something in the page to lose focus of the address bar but I it won’t work.

What I tried:

WebUI.focus(findTestObject('Object Repository/TestObject'));
...
WebUI.click(findTestObject('Object Repository/TestObject'));

I also cannot find anything related to this issue.

Any tips?

1 Like

Try this Test Case.

import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

//
TestObject makeTestObject(String id, String xpath) {
	TestObject tObj = new TestObject(id)
	tObj.addProperty("xpath", ConditionType.EQUALS, xpath)
}

WebUI.openBrowser("https://www.google.com/")

TestObject body = makeTestObject("body", "//body")
WebUI.waitForElementVisible(body, 10)

WebUI.focus(body)
WebUI.click(body)

WebUI.closeBrowser()

This code workd fine for me.


Any HTML will have a body element, right?

So you should be able to focus on the body element.

Hey! Thanks for the quick reply.

Unfortunately, the address bar is still selected.

I also click a button after opening the browser, so I don’t know what the hell is going on. The address bar should lose focus.

Me too…

I believe Katalon does nothing like this.

Something specail your browser might have.

Do you have any malicious browser plugin installed?

What happen if you use other browser (FirFox, Edge, Safari)?

Weird, since the only thing I changed was to upgrade to Katalon 10.1.1. It was working before.

I disabled some plugins but I get the same result. And for some reason I cannot start my test in Firefox..

Please check the .log of Katalon Studio.

You may find something that indicates the cause.

Have up updated the WebDriver of FF on your machine?

Last error was

!ENTRY org.eclipse.e4.ui.workbench 4 0 2025-03-31 10:56:46.270
!MESSAGE Widget is disposed
!STACK 0
org.eclipse.swt.SWTException: Widget is disposed

but that’s like almost two hours ago.

I also tried

WebUI.sendKeys(findTestObject('Object Repository/backdrop'), Keys.chord(Keys.F6));
// and
WebUI.sendKeys(findTestObject('Object Repository/backdrop'), Keys.chord(Keys.ESCAPE));

since both defocus the address bar, without success.

I updated the Firefox webdrivers but still cannot start my test.

Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line 

See the following topic

Hey! Sorry for not replying back yesterday.

I sadly cannot invest time into getting the tests to work in Firefox.

It seems as Katalon won’t recognize any clicks as “clicks that change focus” since I am clicking into login/password text fields and then pressing a submit button → which should remove focus from the address bar.

I also tried sending it CTRL+F6 but it still didn’t work.

WebUI.sendKeys(findTestObject('Object Repository/login_'), Keys.chord(Keys.CONTROL, Keys.F6));

I have no more idea.

Thanks for replying though - I’ll document my solution here if I solve this. Google already throws this thread as first result.

I happend to read this:

There seems to be a bug in WebDriver. But the issue was not marked resolved. This issue was already closed due to limited conversation.

I solved it. It was indeed an issue with a chrome flag.

I deleted the --app=... flag and the url bar is no longer in focus. Prior to deletion I had two separate windows (one BiDi-CDP Mapper and my page) and now I have two tabs in one window.

image

3 Likes

Thank you for sharing the solution.

1 Like

Sure!

The flag for me looks something like this:

--app=http://...:8600/
1 Like