Could not able to navigate to the link

hi

i am doing testing for the below website.
I am recording the path, once i try to run the same test case for navigation. It gets failed.

Below I have given the website and its path.

when i run the test case, i want to go to View EC. its not working.

Please check and help me.

thanks

website:- https://tnreginet.gov.in/portal

Just adding the error:-

=============== ROOT CAUSE =====================
Caused by: org.openqa.selenium.ElementNotInteractableException: Element could not be scrolled into view
At object: ‘Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC’

2 Likes

Format your logs for better readability.

example below

com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:67)at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
1 Like

Add a Wait Step: Insert an explicit wait before the click action to ensure the “View EC” link is present and visible

Use Scroll Into View: Before clicking, use Katalon’s scrollToElement keyword to bring the element into the viewport:

Explicitly scroll into view before clicking:

  • WebUI.scrollToElement(findTestObject('Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC'), 10) WebUI.click(findTestObject('Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC'))

Wait for element to be visible and clickable:

  • WebUI.waitForElementVisible(findTestObject('Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC'), 20) WebUI.waitForElementClickable(findTestObject('Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC'), 20) WebUI.click(findTestObject('Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC'))

If standard click fails, use a JavaScript click:

  • WebUI.executeJavaScript('arguments.click();', [findWebElement(findTestObject('Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC'), 20)])
1 Like

By using copilot AI. I rewrite the code and its working. Below the modified code.

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.testobject.TestObject
import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.driver.DriverFactory
import org.openqa.selenium.JavascriptExecutor

TestObject viewEC = findTestObject("Object Repository/Page_Inspector General of Registration - Ta_dbd4ef/a_View EC")
WebElement element = WebUI.findWebElement(viewEC, 20)

JavascriptExecutor js = (JavascriptExecutor) DriverFactory.getWebDriver()
js.executeScript("arguments[0].click();", element)

Thank you so much for the solution and help

1 Like

Wonderful !! what made you use Copilot? Did you try other AI also?

1 Like

i tried chatgpt , perlexity. but Copilot gave the solution.

1 Like

WebUI.jsClick keyword, which was newly added at v10.3.1, would do the similar.

Here I quote the source code of com.kms.katalon.core.webui.keyword.builtin.JsClickKeyword class of v10.3.1:

package com.kms.katalon.core.webui.keyword.builtin

import java.text.MessageFormat

import org.openqa.selenium.JavascriptExecutor
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement

import com.kms.katalon.core.annotation.internal.Action
import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.exception.StepFailedException
import com.kms.katalon.core.keyword.internal.SupportLevel
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.common.WebUiCommonHelper
import com.kms.katalon.core.webui.constants.StringConstants
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword
import com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain

import groovy.transform.CompileStatic

@Action(value = "jsClick")
public class JSClickKeyword extends WebUIAbstractKeyword {

    @CompileStatic
    @Override
    public SupportLevel getSupportLevel(Object ...params) {
        return super.getSupportLevel(params)
    }

    @CompileStatic
    @Override
    public Object execute(Object ...params) {
        TestObject to = getTestObject(params[0])
        FailureHandling flowControl = (FailureHandling)(params.length > 1 && params[1] instanceof FailureHandling ? params[1] : RunConfiguration.getDefaultFailureHandling())
        jsClick(to,flowControl)
    }

    @CompileStatic
    public void jsClick(TestObject to, FailureHandling flowControl) throws StepFailedException {
        WebDriver driver = DriverFactory.getWebDriver()
        long timeout = RunConfiguration.getTimeOutInMillis()
        WebUIKeywordMain.runKeywordUntilTimeout({retryContext ->
            boolean isSwitchIntoFrame = false
            try {
                WebUiCommonHelper.checkTestObjectParameter(to)
                isSwitchIntoFrame = WebUiCommonHelper.switchToParentFrame(driver, to)

                JavascriptExecutor jsExec = (JavascriptExecutor) driver
                WebElement element = findWebElement(driver, to, timeout)

                logger.logDebug("Checking if element is interactable: " + to.getObjectId())
                if (element != null && driver instanceof JavascriptExecutor) {
                    waitElementInteractable((JavascriptExecutor) driver, element, timeout, retryContext)
                }

                logger.logDebug(MessageFormat.format(StringConstants.KW_LOG_INFO_CLICKING_ON_OBJ, to.getObjectId()));
                jsExec.executeScript("arguments[0].click();", element)
                logger.logPassed(MessageFormat.format(StringConstants.KW_LOG_PASSED_OBJ_CLICKED, to.getObjectId()));
            } finally {
                if (isSwitchIntoFrame) {
                    WebUiCommonHelper.switchToDefaultContent(driver)
                }
            }
        }, flowControl, RunConfiguration.getTakeScreenshotOption(), (to != null) ? MessageFormat.format(StringConstants.KW_MSG_CANNOT_CLICK_ON_OBJ_X, to.getObjectId())
        : StringConstants.KW_MSG_CANNOT_CLICK_ON_OBJ)
    }
}

in some situations, the keyword would be helpful.