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 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("http://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 != "http://forum.katalon.com/") {
KeywordUtil.markFailedAndStop("Something went wrong")
}
wam is just my way of writing comments to the output:
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)
Sorry, I forgot about makeTO - get it here if you think it useful.
So, the outcome is this:
verifyAllLinksOnCurrentPageAccessible() is working in 7.0.10.
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.
@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?
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
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
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.
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.
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.
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.
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.