How to access local hosts file while opening an url

Hi,
I have an testing website whose url is written in the local hosts file . When i am accessing the URL , it gives message as “The Host is not resolvable.” . The host is defined in my hosts file .
How to do it using Katalon Studio .
I cannot access the website by directly providing the IP address of the URL .
Please help

Does the same URL work when using the browser normally?

hello

open your url from pc location
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);
}

}

I have just tried to open browser and navigate to a URL that requires my host file and it works fine through KS. Please check all the details are correct in both KS and your host file.

Hi ,
Its not working .
The site is developed using angular .
The site is hosted in local intranet . The name of the site is provided in local hosts file present at
“C:\Windows\System32\Drivers\etc\hosts” . When i am accessing the site using Katalon Studio , its giving message as
“The Host is not resolvable.”

yes, the same url is working fine when opened in a normal browser .

Its not working when executing the katalon script

If time permits, Harry, post some screens.

Hi ,
After writing java code using selenium and executing through eclipse , the URL is accessed .
But when the same URL is accessed using Katalon Studio , it gives message as “The Host is not resolvable.”.
The hostname is written in the “C:\Windows\System32\Drivers\etc\hosts”.
The testing URL is configured in such a way that it cannot be accessed by giving the IP directly.
Please help .

So really there are no screens i could share that would add any benefit, the host is in my host file and then in my script im just navigating to the URL and it accesses the page fine. Now it may be down to your local network. Myabe try configuring Katalon to “Use system proxy configuration”.

https://docs.katalon.com/katalon-studio/docs/proxy-preferences.html
https://docs.katalon.com/katalon-studio/tutorials/configure_katalon_studio_web_automation_test_project.html#proxy-settings

If you can access the site perfectly fine yourself outside of KS then it must be something to do with your KS settings so id suggest looking into it.

1 Like

Thank you. The issue is with my proxy configuration . After disabling the proxy at Katalon Studio , i am able to access the site . Following is my new concern . If i disable the proxy , i am able to access the site but then i won’t be able to access Katalon Analytics since we can access internet only through proxy .
How can i achieve both simultaneously using Katalon Studio .
i) Access the URL mentioned in hosts file bypassing proxy.
ii) Access the katalon analytics using proxy .

Hey asishgupta!

I think that’s not so bad, because you can manually upload the results from katalon to the analytics website.
Just look into “Reports” in the Tests Explorer on the left side. There you find the testreports, which you then again can upload to katalon analytics, after you enabled the proxy again.

That’s the easiest workaround that came into my mind now.

Thanks tor the solution.