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 ?
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.
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.
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.
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")
}
}
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 ?