Unable to automate login for a website using Katalon

Hello Team,
I’m not able to automate log in process for a website. When the script clicks on “sign in” button, it gets stuck and eventually “something went wrong” message is displayed on page. I’m able to log in manually to this page. However, if I try to log in through a browser opened by Katalon, then it doesn’t work.
Could there be a chance that the website blocks automated software ?
I’ve tried to use this option in project settings : excludeSwitches: enable-automation. This option disables that message on top in browser which says chrome is being controlled by automated test software. But, still I get the same issue, and am not able to proceed further.
I’ve tried Edge and Firefox as well. They also give same behavior.
Is there anything I can try here to make it work ?

Thanks,
Gurleen

1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

In the meantime, please also check out our posting guide below to see if you may need to add any extra info in your topic to help us help you better :point_down:

Thanks! :sunglasses:

Hi there Gurleen, :wave:

Would you be able to attach a screenshot or video recording of the issue in your thread, or maybe an error log as well?

Thanks,
Albert

When you try to log in, are you using regular characters for both “username” and “password”? What happens when you manually put in a wrong “password”? Do you get the same error message? The error log, [ from menu Help > Error Log ], would be good to show.

There’s nothing in Katalon error logs for this test. Attaching the web application screenshots.

When the script clicks on Sign in button, the spinner on Sign in button keeps spinning for a minute.

After a minute, I get the message as “Something went wrong”

Attaching dev tools screenshot from web app also, in case that helps figuring out.




yes, those are regular characters for both username and password. Even when i manually put in a wrong password in a browser window opened by Katalon, I get the same behavior. Error logs in Katalon don’t have anything. However, I’ve attached the screenshots in above response from the web application, and also from the dev tools, if it helps. Thanks.

Did you get any solution ?

I didn’t get any solution yet, still figuring out.

It looks like you found a bug…

It sounds like you need to report this to the Dev team for that app you’re testing, and not on here…

Would you like to join me on skype or Zoom ? So we can try to figure it out ?

I’m able to successfully login when i do it manually. The issue is only with Automation script. It doesn’t work via automation script. That’s why posted here.

Hi Gruleen,

Have you tried to rewrite the click function? I encountered the same issue before when I was running the script by auto record.

After putting in the password, try adding a delay for like 10 seconds before clicking the sign in button.
Does that do anything?

1 Like

As an aside to @jiebin.gao idea, here are other means to “click”

WebUI.enhancedClick(findTestObject('...'))

and the below I have as Keywords that need a Test Object:

import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import org.openqa.selenium.JavascriptExecutor as JavascriptExecutor
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.common.WebUiCommonHelper as WebHelper

	/**
	 * Perform a click on Test Object
	 * @param to = our test object
	 * @param timeout
	 */
	@Keyword
	public static clickUsingJS(TestObject to, int timeout = 10) {
		try {
			WebDriver driver = DriverFactory.getWebDriver()
			WebElement element = WebHelper.findWebElement(to, timeout)
			JavascriptExecutor executor = ((driver) as JavascriptExecutor)
			executor.executeScript('arguments[0].click()', element)
		} catch (Exception) {
			WebUI.comment("Could not click on Test Object")
		}
	}

Edit: or you can simplify the above with:

import org.openqa.selenium.WebElement as WebElement

	/**
	 * Perform a click on Test Object
	 * @param element = our Test Object
	 * @param timeout
	 */
	@Keyword
	public static clickButtonJS(TestObject to) {
		try {
			WebElement element = WebUI.findWebElement(to, 10)
			WebUI.executeJavaScript("arguments[0].click()", Arrays.asList(element))
		} catch (Exception) {
			WebUI.comment("Could not click on Test Object")
		}
	}

Did that. Doesn’t help

@grylion54 @kazurayam Tagging you to get some advise on this issue plz.

The problem is not with script. It’s able to click the button. The problem is… the web page behaves differently when I’m using a script. After clicking on sign in, it doesn’t take me to next screen. It remains at the same page, gives the spinning load icon, and eventually gives me “something went wrong”.

And, the behavior is same if, let’s say i open the browser using automated script, and then stop the script. If i manually put the username, password, and click on Sign in button, then also the behavior is same. So, the issue is i’m not able to go through if i’m using a browser opened by katalon. If i use a normal browser window (not opened by katalon), then it works fine.

So, I just need feedback that based on the console errors i posted in above screenshots which comes when using automation browser window, it says “response blocked by corb” Can we say that the website is able to recognize it’s being controlled by an automated software, and not allowing access due to some security settings ?

Let me try to sort it out, if we can have contact Via Skype/ Zoom

sure, we can connect on zoom. what day/time works for you ?

1 Like

my id is noorahmed504 @ hotmail . com
Kindly share your id also, so we can connect

1 Like

I’ve emailed you. Hopefully you got it. Thanks.