Unable to test local website


#1

I have a local website that I would like to test using Katalon, but it is not finding the path to it. For instance, my website is on my harddrive at: file:///D:/user/Downloads/Website/Website/index.html and shows up fine on any browser. However, when I try to use it in Katalon, I get the following message: [error] Access to ‘file:///D:/user/Downloads/Website/Website/index.html’ from script denied.

Any ideas on how to resolve?


#3

Hello,

TestCase

String fileName = "index.html"
String home = System.getProperty("user.home")
url = home+"\\Downloads\\Website\\Website\\" + fileName

CustomKeywords.'readGmail.openWebHtml.openHtmlPage'(url)

Keyword

import java.awt.Desktop

import com.kms.katalon.core.annotation.Keyword

public class openWebHtml {

	@Keyword
	public void openHtmlPage(String url){

		File file = new File(url);
		URI oURL = file.toURI();
		Desktop.getDesktop().browse(oURL);
	}
}

#4

Hi,

The error is shown in my original post. I am trying to do a record and playback in Katalin itself just to see if the script will run. I have not yet exported the code yet. As such, the playback isn’t working in Katalon as it can’t find the local URL. Accessing the website from any browser works fine.


#6

here is the type of error that I’m getting.


#8

C:\ProgramData is a special folder on Windows with particular permissions


With Chrome, I get a different error when trying to access an htm file in this folder. The open command passes, but the actual file does not get opened, and any subsequent tests fail.

Is there a particular reason why you are testing in this folder?

===
For local testing can I suggest setting up IIS on your machine, if it isn’t already?
HTML Files would then reside in C:\inetpub\wwwroot\ and can be accessed through a browser using the HTTP protocol http://localhost/.

In your case, the set up would be something like
C:\inetpub\wwwroot\SearchRestore\restore.htm
which can be accessed with
http://localhost/SearchRestore/restore.htm

and the Katalon Recorder command would be

open | http://localhost/SearchRestore/restore.htm

which will open the page as expected.

Edit
With reference to your initial post:
In IIS you can set up a virtual directory Website which would point to D:/user/Downloads/Website/Website/index.html