Webui.exception

hi i want to run the web test case but when i try to run the test case it gives me an error "Unable to navigate (Root cause: com.kms.katalon.core.webui.exception.BrowserNotOpenedException: Browser is not opened

Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’

System info: host: ‘DESKTOP-SCPPO96’, ip: ‘192.168.1.19’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’

Driver info: driver.version: unknown)"

please help :frowning:

Did you have WebUI.openBrowser() or WebUI.navigateToUrl() somewhere near the top of the script?

Hi Mate,

This is the script which is generating for my test case

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.testcase.TestCase as TestCase

import com.kms.katalon.core.testdata.TestData as TestData

import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable as GlobalVariable

import org.openqa.selenium.Keys as Keys

WebUI.navigateToUrl(‘http://192.168.1.104:8282/login.aspx’)

WebUI.setText(findTestObject(‘Object Repository/Page_/input_concat(id( cphMain_txtU’), ‘admin’)

WebUI.setText(findTestObject(‘Object Repository/Page_/input_concat(id( cphMain_btSu’), ‘admin’)

WebUI.click(findTestObject(‘Object Repository/Page_/input_concat(id( cphMain_btSu_1’))

WebUI.closeBrowser()

You need to open browser before telling Katalon to navigate to a URL. So, add this line before WebUI.navigateToUrl():

WebUI.openBrowser('')

Mate Mrse said:

You need to open browser before telling Katalon to navigate to a URL. So, add this line before WebUI.navigateToUrl():

WebUI.openBrowser('')

Dear Mate,

The browser is open when running this test case but this is not working still :frowning:

the test case running first time perfectly, but after saving the test case and trying to re run it through the same exceptions for all browsers.

Can you check this line again:

WebUI.navigateToUrl('http://192.168.1.104:8282/login.aspx')

When I click it I get directed to " http://192.168.1.104:8282/login.aspx ’ ".

(I added extra spaces after the quotes for visibility.)

It seems there is an extra '.

No, Still not working.

But, are you still getting the same error?

If not, please post the error, maybe we’ll be a step closer to the solution.

No, I’m Still getting the same error :frowning:

Mate Mrse said:

Can you check this line again:

WebUI.navigateToUrl('http://192.168.1.104:8282/login.aspx')

  
When I click it I get directed to "    http://192.168.1.104:8282/login.aspx    '    ".   
  
(I added extra spaces after the quotes for visibility.)  
  
It seems there is an extra '.   
  
Hey,   
  
when i redirect to the link with the tool it comes like [http://192.168.1.104:8282/login.aspx'](http://192.168.1.104:8282/login.aspx' "Link: http://192.168.1.104:8282/login.aspx'") but when i try this link directly in browser it is working fine. is there anything missing in the tool installation or something else?   
Thank you i really appreciate your response.

Hamna,
please try this and post all results:
1. add OpenBrowser(’’) befor navigate (what happend?)
2. describe way you executing this TC (manually/call from other TC… how)
3. are results same for all browsers?
4. describe how you get TC (record [execution ok?] then save to Studio [excution fails?] how?)
5. anything special about way you are using Katalon Studio?

Andrej Podhajský said:

Hamna,
please try this and post all results:
1. add OpenBrowser(’’) befor navigate (what happend?)
2. describe way you executing this TC (manually/call from other TC… how)
3. are results same for all browsers?
4. describe how you get TC (record [execution ok?] then save to Studio [excution fails?] how?)
5. anything special about way you are using Katalon Studio?

Dear Andrej,

Thank you for your reply i really appreciate that :slight_smile:
the results are below:

  1. add OpenBrowser(’’) before navigate (what happens?) " if i add manually OpenBrowser(’’) it works fine. but if i record the web it starts from navigate to URL."
    2. describe way you executing this TC (manually/call from other TC… how) “If i use this manually it is working fine but after recording, when i re run the recorded test case it gives the exception from which i initiate this post.”
    3. are results same for all browsers? “Yes”
    4. anything special about way you are using Katalon Studio? “i dont think so because i’m following the tutorials which are available on katalon website.”

@Hamna, in my opinion, record web option should be only the starting point for creation of test cases. After recording, you tweek and refine your tests, for example, by adding the WebUI.openBrowser(). If the test is executing properly after this, is it a problem?

Mate Mrse said:

@Hamna, in my opinion, record web option should be only the starting point for creation of test cases. After recording, you tweek and refine your tests, for example, by adding the WebUI.openBrowser(). If the test is executing properly after this, is it a problem?

Yes Mate, After adding WebUI.openBrowser() it is working fine.


1 when you execute test from katalon studio, even after recording and browser in which you did recording is opened, Katalon will take allways 2 - new session.
only time you can choose existing browser 3 is when TC toy are running failed and browser was not closed.
so even if you have 20 opened browsers, TC does not know about that unless you tell him in moment of execution.
therefore, after record do as @Mate Mrse
suggested - add openBrowser() command to your script even recorder does not do that

image.png