[WebUI] Get Url


#1

This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-get-url.html

#2

Hi. Help me please. result = WebUI.getText(findTestObject(‘Object Repository/RolesObjects/OrgRolesObjects/InviteRolesPage/InviteLink’))WebUI.openBrowser(’’)
WebUI.navigateToUrl(result)

 how I can past  token to URL ?  Its not working...

#3

WebUI.navigateToUrl accepts String. So what ever you pass to this keyword will get resolved.
concat result variable with token and then pass to the navigateToUrl keyword.


#4

result = WebUI.getText(findTestObject(‘Object Repository/RolesObjects/OrgRolesObjects/InviteRolesPage/InviteLink’))

I put it String to url ,but this not work
WebUI.openBrowser(’’)
WebUI.navigateToUrl(result)

Thank’s for help


#5

Can you try logging the value of InviteLink object? Try converting it to String before passing to navigateToUrl keyword.


#6

How I can to do this? I just starting to work with Katalon,


#7

it’s converting it to String ?
String result = WebUI.getText(findTestObject(‘Object Repository/RolesObjects/OrgRolesObjects/InviteRolesPage/InviteLink’))

Thank you, Aliasger


#8

Glad to know that you got the solution


#9

But its not working…


#10

02-21-2019 04:37:52 PM Test Cases/TestTests/InviteOrgAdminUserToOrganization

Elapsed time: 1m - 19.329s

Test Cases/TestTests/InviteOrgAdminUserToOrganization FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to navigate to ‘’ (Root cause: java.lang.IllegalArgumentException: Url cannot be null or empty)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
at com.kms.katalon.core.webui.keyword.builtin.NavigateToUrlKeyword.navigateToUrl(NavigateToUrlKeyword.groovy:83)
at com.kms.katalon.core.webui.keyword.builtin.NavigateToUrlKeyword.execute(NavigateToUrlKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.navigateToUrl(WebUiBuiltInKeywords.groovy:183)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$navigateToUrl$8.call(Unknown Source)
at InviteOrgAdminUserToOrganization.run(InviteOrgAdminUserToOrganization:68)
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:328)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1550759870807.run(TempTestCase1550759870807.groovy:22)


#11

Errors what I get


#12

From the error logs it seems that WebUI.getText(findTestObject(‘Object Repository/RolesObjects/OrgRolesObjects/InviteRolesPage/InviteLink’)) is not giving any result or blank. Can you please check this first? what is the value getText is giving?
One more option is if that object is already a link why cant you directly click on it instead of reading the url and navigating to it?