# How to access local hosts file while opening an url

**URL:** <https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [June 5, 2019, 1:54pm UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069 "2019-06-05T13:54:26Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 5, 2019, 1:54pm UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/1 "2019-06-05T13:54:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 5, 2019, 2:06pm UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/2 "2019-06-05T14:06:07Z")

</div>

Does the same URL work when using the browser normally?

---

<div class="post-metadata">

**Author:** ![Timo\_Kuisma](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@Timo\_Kuisma](https://forum.katalon.com/u/Timo_Kuisma)\
**Post date:** [June 5, 2019, 2:09pm UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/3 "2019-06-05T14:09:23Z")

</div>

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);
}

```

}

---

<div class="post-metadata">

**Author:** ![hpulsford](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hpulsford/32/2985_2.png) [@hpulsford](https://forum.katalon.com/u/hpulsford)\
**Post date:** [June 5, 2019, 2:10pm UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/4 "2019-06-05T14:10:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 6, 2019, 6:29am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/5 "2019-06-06T06:29:01Z")

</div>

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.”

---

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 6, 2019, 6:29am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/6 "2019-06-06T06:29:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 6, 2019, 6:29am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/7 "2019-06-06T06:29:11Z")

</div>

Its not working when executing the katalon script

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 6, 2019, 6:30am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/8 "2019-06-06T06:30:09Z")

</div>

If time permits, Harry, post some screens.

---

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 6, 2019, 7:34am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/9 "2019-06-06T07:34:00Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![hpulsford](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hpulsford/32/2985_2.png) [@hpulsford](https://forum.katalon.com/u/hpulsford)\
**Post date:** [June 6, 2019, 8:11am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/10 "2019-06-06T08:11:51Z")

</div>

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/docs/proxy-preferences.html)  
[https://docs.katalon.com/katalon-studio/tutorials/configure\_katalon\_studio\_web\_automation\_test\_project.html#proxy-settings](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.

---

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 6, 2019, 9:10am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/11 "2019-06-06T09:10:44Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![Dominik\_Kreft](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dominik_kreft/32/5433_2.png) [@Dominik\_Kreft](https://forum.katalon.com/u/Dominik_Kreft)\
**Post date:** [June 6, 2019, 1:35pm UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/12 "2019-06-06T13:35:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![asishgupta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/asishgupta/32/23869_2.png) [@asishgupta](https://forum.katalon.com/u/asishgupta)\
**Post date:** [June 8, 2019, 10:28am UTC](https://forum.katalon.com/t/how-to-access-local-hosts-file-while-opening-an-url/27069/13 "2019-06-08T10:28:43Z")

</div>

Thanks tor the solution.
