Test Suite Collection: navigateToUrl() not working

Florian, try this…

Take the code out of the suite listener, put it in a Keyword class/method. Call the method from the suite listener.

I had an issue with a global map which didn’t work directly in the suite listener but worked when moved to a class/method.

1 Like

Hi,
thanks for your reply @Russ_Thomas.

As far as I understand your proposed option, this won’t solve the problem. The problem is, that I cannot use any Global Variable in my whole testsuite (including test cases, keywords and testlistener), while trying to connect to browserstack. If I do so, the mentioned exceptions are thrown.

I tried it anyways to verify my assumption and commented out everything in my test listener, that used a Global Variable, so that basically only
WebUI.openBrowser("")

WebUI.maximizeWindow()

was left. The testlistner was passed. But as soon as a Global Variable was called within the test cases, or in a keyword, the exception is being thrown.

So the problem is not only restricted to the test listener, but the whole test suite, including test cases and keywords. Maybe I wasn’t that clear before. If so, sorry, for that.

So, do you have another possible solution?

Best,
Florian

2 Likes

is this working fine with browserstack execution?
if yes, i think is an acceptable workaround to initiate the webdriver with empty url and further navigate to the desired page.
i usualy choose this workflow (altough my experience with UI testing is limited, i mostly do backend testing)

not sure how the driver is actualy instantiated when a remote profile is needed (i never used browserstack). here some devs may help … or perhaps @kazurayam, he is skilled with digging under the hood of libs.

2 Likes

Yes, If I only execute the test suite with the remote profile and not the test suite collection, this works fine. Also with any other combination of method, variable and value.

In my attempts to find a workaround, I already tried this and it seems, that non of the Global Variables are assigned correctly when used within a test suite collection. Therefor, any keyword or method will fail, in which I reference them.

1 Like

can we see a screenshot of the test collection setup too? something does not fit …

1 Like

Hi,

unfortunately, I am on vacation now and can’t access the tests from here. A colleague of mine will post some screenshots soon and I will get back to you as soon as possible.

Best,
Florian

1 Like

Let me just make sure about a configuration of Test Suite Collection.

In the definition of a Test Suite Collection, you are supposed to assign a Execution Profile name to each Test Suites bundled in the collection, as the following screenshot shows.


The default value of “Profile” column is “default”. If you have your own Execution Profiles, you should explicitly rewrite the names.

@Florian_Braun

Are you sure you have assigned appropriate name of Execution Profile for Test Suite here?

If you leave the “Profile” to be something like “default” which does not include “GlobalVariable.G_URL_Home”, then the following code

        WebUI.navigateToUrl(GlobalVariable.G_URL_Home)

will certainly fail with a message Unable to navigate to null.

2 Likes

this is why i asked for a screenshot. i remember it was a glitch in a certain version (not remember exactly which one) where that column is not visible so the user has to do a trick on the header. could be the case
@Florian_Braun please check if you have such set-up
also make sure the needed variables are defined in the selected profile

1 Like

@Florian_Braun here you go


image

1 Like

@Florian_Braun

Are you behind your organization’s Proxy?

If so, the following post might be interesting for you. There are many cases, with various reasons, which give you the message Unable to navigate to null.

1 Like

Hi all,

back in the office and I will try to summarize the issue:

The problem is, that I cannot use any Global Variable in my whole testsuite collection (including test suites, test cases, keywords and testlistener), while trying to connect to browserstack. If I do so, this exception is thrown:

Test Cases/ProfileFunctionalities/Login-Logout FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to navigate to 'null'
	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.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:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.navigateToUrl(WebUiBuiltInKeywords.groovy:183)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$navigateToUrl$0.call(Unknown Source)
	at Login-Logout.run(Login-Logout: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.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:150)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:123)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:87)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1571659961461.run(TempTestSuite1571659961461.groovy:35)
Caused by: java.lang.IllegalArgumentException: Url cannot be null or empty
	at com.kms.katalon.core.webui.keyword.builtin.NavigateToUrlKeyword$_navigateToUrl_closure1.doCall(NavigateToUrlKeyword.groovy:75)
	at com.kms.katalon.core.webui.keyword.builtin.NavigateToUrlKeyword$_navigateToUrl_closure1.call(NavigateToUrlKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	... 19 more

What works:

  1. Test suite that is run remotely on Browserstack and global variables stored in a profile.
  2. Test suite collection that is run with a locally installed browser instance and global variables stored in a profile.

What I already tried to narrow it down

  1. As the test suite is already running on Browserstack and the exception is not the same as in the problem behind a proxy I suppose, that this problem has nothing to do with it. Thanks anyways @kazurayam, this restriction is good to know about as well.
  2. The setup of the profiles and the test suite colltection is as far as I am aware correct, as you can see here. At least locally, it all works fine. The test suite for itself runs remotely with the profile as well fine.
  3. I tried to hardcode the values of the global variables that are stored in a profile in the test listener and test cases and the test suite collection worked not only locally, but also remotely (i.e. the URL can be resolved etc.).
  4. I tried to call a global variable not in the test listener (here’s the setup), but only in the test cases and the mentioned exception is thrown. This means, the problem is not restricted to the test listener. Test cases will throw the same exception.

My conclusion
This problem is only restricted to the combination of a

  1. test suite collection,
  2. Browserstack and
  3. the usage of global varibales stored in a profile.

So I guess, that this is the best guess at the moment:

@Ibus, @Russ_Thomas, @ThanhTo, @devalex88, @duyluong: Have you any hints, how to solve this?

Many thanks,
Florian

1 Like

for the sake of my mind sanity, have you checked if the right profile is set in your test collection?
the profile himself looks OK from your previous screenshot, but are you 100 % sure the right one it is used?
see the bellow pic:

in your sshots, you posted the profile with Stage something, but in the collection settings a different one is choosen (blah DEV) for the Remote execution

1 Like

Hi @Ibus,
yes this profile is a valid profile and works with every test suite.
Best,
Florian

1 Like

@Florian_Braun
i just wanted to be sure … sometime i am hit by such mistakes, therefore more eyes are always welcomed.
unfortunately i am not using browserstack so i cannot attempt to reproduce your issue … let’s wait for other people input.

1 Like

I’m having a very similar issue even with the most basic test case. I’m using the suggested ‘autoit’ solution for login, removed using the Global Variable and it’s still not working.


When the browser window opens, I see it flicker for a second like it’s trying to navigate to the page but then it stays on blank browser screen. Looking at the LogViewer, it seems to think it successfully navigated:

Of course this all used to work. I believe this started happening after upgrading to V7.

I’m currently on 7.0.6.

1 Like

hello,

why not to use .properties files or .yaml files where needed variables are defined
this is only suggestion :slight_smile:

1 Like

@Timo_Kuisma1, sure, there are many workarounds. But as I am working mostly with people, who haven’t any devloper experience at all, I want to use the solution, that comes out of the box.
@Ibus sure thing. I am still hoping, that this problem is actually related to a simple mistake in the setup or something. But I cannot think of any. So please doubt further, maybe we’ll solve it like this.

1 Like

@Florian_Braun

How about doing just a simple debug print in the test case in the Test Suites/Debugging/DebuggingTestSuite:

import com.kms.katalon.core.configuration.RunConfiguration

WebUI.comment("You selected Execution Profile: ${RunConfiguration.getExecutionProfile()}")
WebUI.comment("GlobalVariable.G_URL_Home=${GlobalVariable.G_URL_Home}")

And see what you get in the console.

1 Like

Thank you for the report. If possible please try version 7.1.0 RC1 and let us know if it fixed the issue.

1 Like

Dear @devalex88: It seems that this issue is being solved in this version. Thanks a lot!

And many thanks to @Ibus, @kazurayam and @Russ_Thomas.

Best, Florian

2 Likes