Method call to verify links reports good links as inaccessible

Hello, I have a script that uses the “verifyAllLinkOnCurrentPageAccessible” function. All the links used to pass until recently (before upgrading to Katalon 7.0 I believe). Was there a change to this method?

Now I’m getting a lot of failures, mainly for links to .css, .ico, aspx, etc.

However I can paste all those links in my browser window, they open fine.

I’m using:
Katalon 7.0.10
browser = Chrome 78.0.3904.108

I think you’ll need to show us some of the HTML, code and errors.

I tried this:

    wam 'Nav to Katalon forum page'
    WebUI.navigateToUrl("https://forum.katalon.com/t/method-call-to-verify-links-reports-good-links-as-inaccessible/36544")
  
    WebUI.waitForPageLoad(10)
  
    wam 'Check ALL links are accessible'
    WebUI.verifyAllLinksOnCurrentPageAccessible(false, null, FailureHandling.CONTINUE_ON_FAILURE)
    
    wam 'Navigate to Katalon home page using makeTO and the "K" link on the forum page'
    TestObject to = makeTO("section#main a[href='/']")
    WebUI.click(to)
    
    String sURL = WebUI.getUrl()
    if(sURL != "https://forum.katalon.com/") {
      KeywordUtil.markFailedAndStop("Something went wrong")
    }
        

wam is just my way of writing comments to the output:

(BIG SNIP)

The code is pretty basic:

WebUI.openBrowser('')

autoit_prj = 'C:\\Apps\\Git\\authenticate.exe'
Runtime.getRuntime().exec(autoit_prj)
Thread.sleep(2000);

WebUI.navigateToUrl(GlobalVariable.G_SiteURL)

//Validate all links on this page
WebUI.verifyAllLinksOnCurrentPageAccessible(false, null)

WebUI.closeBrowser()

These are the errors I’m getting (took out all 70, just leaving the first few. domain replaced with XYZ):

2019-11-19 11:54:17.622 WARN c.k.k.core.keyword.internal.KeywordMain - Found 70 inaccessible links [http://XYZ.net/generalrequest/images/GR.ico, http://XYZ.net/generalrequest/App_Themes/TEST/ER.css, http://XYZ.net/GeneralRequest/WebResource.axd? at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.builtin.VerifyLinksAccessibleKeyword$_verifyLinksAccessible_closure1.doCall(VerifyLinksAccessibleKeyword.groovy:52)
at com.kms.katalon.core.webui.keyword.builtin.VerifyLinksAccessibleKeyword$_verifyLinksAccessible_closure1.call(VerifyLinksAccessibleKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.VerifyLinksAccessibleKeyword.verifyLinksAccessible(VerifyLinksAccessibleKeyword.groovy:37)
at com.kms.katalon.core.webui.keyword.builtin.VerifyLinksAccessibleKeyword.execute(VerifyLinksAccessibleKeyword.groovy:32)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyLinksAccessible(WebUiBuiltInKeywords.groovy:3709)
at com.kms.katalon.core.webui.keyword.builtin.VerifyAllLinksOnCurrentPageAccessibleKeyword$_verifyAllLinksOnCurrentPageAccessible_closure1.doCall(VerifyAllLinksOnCurrentPageAccessibleKeyword.groovy:40)
at com.kms.katalon.core.webui.keyword.builtin.VerifyAllLinksOnCurrentPageAccessibleKeyword$_verifyAllLinksOnCurrentPageAccessible_closure1.call(VerifyAllLinksOnCurrentPageAccessibleKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.VerifyAllLinksOnCurrentPageAccessibleKeyword.verifyAllLinksOnCurrentPageAccessible(VerifyAllLinksOnCurrentPageAccessibleKeyword.groovy:48)
at com.kms.katalon.core.webui.keyword.builtin.VerifyAllLinksOnCurrentPageAccessibleKeyword.execute(VerifyAllLinksOnCurrentPageAccessibleKeyword.groovy:32)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyAllLinksOnCurrentPageAccessible(WebUiBuiltInKeywords.groovy:3754)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyAllLinksOnCurrentPageAccessible$4.call(Unknown Source)
at Verify all links on main page.run(Verify all links on main page:42)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1574182442553.run(TempTestCase1574182442553.groovy:23)

Here’s some of the html:

I’m starting to wonder about the URLs in the links on your page especially since all 70 fail.

Can you confirm my code? Create a new test, drop my code in, (rename wam to WebUI.comment)

With a couple small tweaks to the code:

The links all passed:

There was an issue clicking on the “to” object, but maybe that’s cause of my updates (replaced makeTo with new TestObject)

In my initial test I do get a lot of links that passed.

Sorry, I forgot about makeTO - get it here if you think it useful.

So, the outcome is this:

  1. verifyAllLinksOnCurrentPageAccessible() is working in 7.0.10.
  2. Your page returns all links as inaccessible.

Try using verifyLinksAccessible() and pass it one or two links from your page. Be absolutely certain you are passing fully qualified URLs. Let me know how that goes.

Using verifyLinksAccessible() also fails.
See attached for full console output.

errors.txt (11.0 KB)

@ThanhTo @devalex88 Is there a way to expose the results of the server call when verifyLinksAccessible() is doing its thing? Would be good to know/show the responses.

@Galina_Moore The links you used are using the http: protocol. Is this correct?

Yes, that’s correct.

Sit tight and wait for the devs to take a look.

Top Secret !!!

Katalon management keep the devs in cages out the back but they’ll be woken in about 3 or 4 hours - and to earn their breakfast, they have to respond to shout outs like mine above :wink:

If you add only the waitForPageLoad then does it pass ? Looks like we need to pin down what changes make the test case pass. Then after that try to comment out waitForPageLoad and add FailureHandling to verifyAllLinksOnCurrentPageAccessible.

@Russ_Thomas, Gonna talk to the team, but I think Chrome Dev Tools allows us to monitor the network requests

Additionally, this is my quick test on 7.0.10:

WebUI.openBrowser('https://forum.katalon.com/t/method-call-to-verify-links-reports-good-links-as-inaccessible')

WebUI.verifyAllLinksOnCurrentPageAccessible(false, [])

WebUI.closeBrowser()

The test passes successfully.

1 Like

I checked in Firefox but the traffic seems to be completely inside Katalon (WebDriver?). IOW, I saw no evidence the browser is used to make the requests.

Yep, you got 100% from this page - same as me.

OK, waitForPageToLoad() did not help. Same result. Just to be clear, a lot of the links on the page do pass.

@ThanhTo, when you say add FailureHandling(), you mean doing this:
WebUI.verifyAllLinksOnCurrentPageAccessible(false, null, FailureHandling.STOP_ON_FAILURE)

Just tried that call and got the same result as before.

Will try the network monitoring next. Stay tuned.

Using the network monitoring in DevTools, I can individually open the links that the script says are inaccessible. Example screenshots below.
I tried having DevTools open while the script is running but it’s not showing any network traffic. Also when I open the URL manually (outside of Katalon) and view the network traffic, there are no errors. All requests show a 200 response.

That is weird. May I ask are you using any kind of proxy ?

Like I sad @ThanhTo, I got similar results in Firefox - no proxy here. I think Katalon/WebDriver is handling the request itself - in essence, it is the proxy.

(One day I’ll learn to use wireshark :roll_eyes: )

@Russ_Thomas

Katalon would create a new Request object and ping to the link to see if there is a response, it is kind of separate from the web driver, so that’s why I think proxy may be an issue.

Right. The question is, what route does that ping use. I see no evidence it passes through the browser. I suspect it’s endpoint (acutally, “beginpoint”) is in Katalon. IOW, looking for that traffic in the browser would never work.

1 Like

@Russ_Thomas Fiddler can capture the traffic too, and is simplest to use compared with wireshark

1 Like