Test cases are failing with error "Unable to click on object" & "Unable to find the element located by 'By.xpath:" when running scripts using Azure Pipeline

Hello,
My test cases are running fine in my local. However, when running the same test case in Azure Pipeline which is running on a remote server, I’m getting lots of errors “Unable to click on object” & “Unable to find the element located by 'By.xpath:”
Because katalon scripts are running in console mode I can’t see what is happening and it’s returning below errors. I tried taking a screenshot, which is returning a blank screen. Please help me to identify the issue and its solution.
Let me know if you need more information.

Solution tried:

  • I have already WebUI.delay(10) statement after before launching the website.

  • Maximized the window

  • The authentication step is showing Passed successfully with both format WebUI.openBrowser(‘https://username:Password@test.abcd.net/’)
    &
    WebUI.authenticate(‘https://test.abcd.net/’, ‘username’, ‘password’, 30, FailureHandling.OPTIONAL)

Log Report

2021-01-11 16:27:15 - [TEST_STEP][PASSED] - abcd.MostlyUsed.launch_abcd(): Taking screenshot successfully

2021-01-11 16:27:16 - [MESSAGE][INFO] - Starting ‘Chrome’ driver

2021-01-11 16:27:16 - [MESSAGE][INFO] - Action delay is set to 0 milliseconds

2021-01-11 16:27:20 - [MESSAGE][WARNING] - FFmpeg was not installed! Browser Recording will be disabled. Please follow this document to install FFmpeg first: https://docs.katalon.com/katalon-studio/docs/screenshots-videos.html#browser-based-recorder

2021-01-11 16:27:21 - [MESSAGE][PASSED] - Browser is opened with url: ‘https://username:Password@test.abcd.net/

2021-01-11 16:27:22 - [MESSAGE][PASSED] - Current window maximized

2021-01-11 16:27:32 - [MESSAGE][PASSED] - Delayed 10 second(s)

2021-01-11 16:27:33 - [MESSAGE][PASSED] - Taking screenshot successfully
[[ATTACHMENT|C:\newagent\_work\13\s\Reports\20210111_162655\All_Page_Accessible_TestCases\20210111_162702\1610400453083.png]]
Showing Blank screen
2021-01-11 16:27:33 - [MESSAGE][PASSED] - Taking screenshot successfully
[[ATTACHMENT|C:\newagent\_work\13\s\Reports\20210111_162655\All_Page_Accessible_TestCases\20210111_162702\1610400453471.png]]

2021-01-11 16:27:38 - [MESSAGE][INFO] - Refreshing

2021-01-11 16:27:38 - [MESSAGE][PASSED] - Refresh successfully

2021-01-11 16:27:39 - [MESSAGE][PASSED] - Taking screenshot successfully
[[ATTACHMENT|C:\newagent\_work\13\s\Reports\20210111_162655\All_Page_Accessible_TestCases\20210111_162702\1610400459060.png]]
Showing Blank screen
2021-01-11 16:27:39 - [TEST_STEP][PASSED] - println(abcdID): null

2021-01-11 16:27:40 - [TEST_STEP][FAILED] - abcd.MostlyUsed.search_And_OpenAMember(abcdID): com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Dashboard_page/Search’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Dashboard_page/Search’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:617)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at abcd.MostlyUsed.search_And_OpenAMember(MostlyUsed.groovy:69)
at abcd.MostlyUsed.invokeMethod(MostlyUsed.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
at TC01_Access_MemberInfo_Page_WithoutError.run(TC01_Access_MemberInfo_Page_WithoutError:30)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:394)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:385)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:364)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:356)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:251)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:203)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:152)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:95)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1610400422806.run(TempTestSuite1610400422806.groovy:39)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Dashboard_page/Search’ located by ‘(//a[@class=‘main’][contains(text(),‘Search’)])[2]’ not found
at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1369)
at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:27)
at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:26)
at 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)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:617)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at abcd.MostlyUsed.search_And_OpenAMember(MostlyUsed.groovy:69)
at abcd.MostlyUsed.invokeMethod(MostlyUsed.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
at Script1597250062222.run(Script1597250062222.groovy:30)
… 13 more
)

2021-01-11 16:27:48 - [MESSAGE][INFO] - Unable to find the element located by ‘By.xpath: (//a[@class=‘main’][contains(text(),‘Search’)])[2]’. Please recheck the objects properties to make sure the desired element is located.

2021-01-11 16:27:48 - [MESSAGE][WARNING] - [SELF-HEALING] Failed to find element with id ‘Object Repository/Dashboard_page/Search’. Try using Self-healing.

Below is my pipeline task settings

  • task: katalonTask@0
    inputs:
    version: ‘7.8.2’
    executeArgs: ‘katalonc -noSplash -runMode=console -projectPath="$(System.DefaultWorkingDirectory)\ABCD.prj" -retry=0 -testSuiteCollectionPath=“Test Suites/ABCD_Page_Access” -statusDelay=15 -executionProfile= “QA” -browserType=“Chrome” -apiKey=“xxxxxx-xxx-xxxxx-ooooooooooo”’

Should I download ffmpeg in the remote server and then change the system variable path? Will it record the browser action?

This may help:

Solution tried

  • The WebUI.enhancedClick method.
  • The WebUI.setViewPortSize(1920, 1080, FailureHandling.OPTIONAL) method instead of maximize.
  • Adding delay 120s.

I’m still getting “Unable to find the element located by 'By.xpath:” errors, and the take screenshot is returning blank screens.
The video folder is blank. The test report has a video step but do not know where to find the video. (I have screen recorder option turn on and Record video during execution is checked. The test cases are running in an Azure remote server)
Please help