# Unable to handle Authentication pop-up window in IE

**URL:** <https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512>\
**Category:** Bug Report\
**Tags:** katalon-studio, bugs-report\
**Created:** [April 25, 2018, 5:20am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512 "2018-04-25T05:20:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gururaj](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Gururaj](https://forum.katalon.com/u/Gururaj)\
**Post date:** [April 25, 2018, 5:20am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/1 "2018-04-25T05:20:38Z")

</div>

Hi i am facing an issue in the below scenario  
On hitting the application URL a authentication pop-up comes up for entering username and password with OK and Cancel button.  
I tired with authentication method  
WebUI.authenticate(‘URL’,‘username’,‘pwd’)  
this did not work  
pls help

NOTE: Inspect element is not working in the pop-up and spy web is also not working when the window comes up

---

<div class="post-metadata">

**Author:** ![ranjeet.yadav](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@ranjeet.yadav](https://forum.katalon.com/u/ranjeet.yadav)\
**Post date:** [September 18, 2019, 9:56am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/2 "2019-09-18T09:56:26Z")

</div>

Hi @tech_support, @katalon_store_suppor

Can you please help us / guide us on our blocker - Unable to handle Authentication pop-up window in Chrome / IE or in any browser.

On hitting the application URL a authentication pop-up comes up for entering username and password with OK and Cancel button.  
I tired with authentication method  
WebUI.authenticate(‘URL’,‘username’,‘pwd’)  
this did not work  
pls help

NOTE: Inspect element is not working in the pop-up

---

<div class="post-metadata">

**Author:** ![danpoleary](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/danpoleary/32/2416_2.png) [@danpoleary](https://forum.katalon.com/u/danpoleary)\
**Post date:** [September 19, 2019, 11:16am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/3 "2019-09-19T11:16:59Z")

</div>

If this is NTLM Authentication, You will need to use javascript and custom keyword to perform the login.

In your test case:

> ‘Execute custom javascript to load the page that requires windows authentication’  
> WebUI.executeJavaScript((‘function myFunction() { setTimeout(function(){ window.location.href = '’ + pageURL) +  
> ‘'; }, 500);}; myFunction()’, )  
> ‘perform the windows authentication using custom keyword LoginAuthenticate’  
> CustomKeywords.‘YOUR\_PACKAGE\_NAME.auth\_keyword.loginAuthenticate’(username, password)

and the custom keyword:

```
package YOUR_PACKAGE_NAME

class auth_keyword {
@Keyword
def loginAuthenticate(String username, String password) {

	String browser = DriverFactory.getExecutedBrowser().getName()
	boolean IE = false
	if (browser.contains('IE')) {
		IE = true
	}

	println 'Browser: ' + browser

	Robot robot = new Robot();
	robot.setAutoDelay(250);
	StringSelection ss = new StringSelection(username);
	Toolkit toolkit = Toolkit.getDefaultToolkit()
	Clipboard clipboard = toolkit.getSystemClipboard().setContents(ss, null);
	robot.delay(1000);
	if (IE) {
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.keyPress(KeyEvent.VK_ENTER);
		robot.keyRelease(KeyEvent.VK_ENTER);
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.keyPress(KeyEvent.VK_ENTER);
		robot.keyRelease(KeyEvent.VK_ENTER);
	}
	robot.keyPress(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_TAB);
	robot.keyRelease(KeyEvent.VK_TAB);
	ss = new StringSelection(password);
	Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
	robot.keyPress(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_TAB);
	robot.keyRelease(KeyEvent.VK_TAB);
	if (IE) {
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
	}
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
}

}

```

---

<div class="post-metadata">

**Author:** ![ranjeet.yadav](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@ranjeet.yadav](https://forum.katalon.com/u/ranjeet.yadav)\
**Post date:** [September 23, 2019, 1:29pm UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/4 "2019-09-23T13:29:57Z")

</div>

Hi @danpoleary,  
CC: @katalon_store_suppor, @tech_support  
Thank you for your technical help on my blocker.  
But still I am struggling to resolve my blocker or may I missing something minor where your help is highly appreciated.

As per your solution I have followed below steps-

1. I have created new custom keyword in my Package  

2. then in my test case, I tried to execute custom javascript to load the page that requires windows authentication. Over here I am getting error as shown in below image-  

Requesting you to please review and let me know what is going wrong.  
Note: I have validated JavaScript Syntax using couple of online JavaScript syntax validator where no syntax error is getting displayed. But in Katalon studio for same line, Syntax error is getting displayed.

Thanks,  
Ranjeet

---

<div class="post-metadata">

**Author:** ![danpoleary](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/danpoleary/32/2416_2.png) [@danpoleary](https://forum.katalon.com/u/danpoleary)\
**Post date:** [September 24, 2019, 6:01pm UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/5 "2019-09-24T18:01:48Z")

</div>

Your executeJavaScript needs to look like:

```
WebUI.executeJavaScript(('function myFunction() { setTimeout(function(){ window.location.href = \'' + pageURL) +
'\'; }, 500);}; myFunction()', [])

```

Where pageURL is your URL.

And then call your method:

```
CustomKeywords.'myPackage.Auth_keyword.loginAuthenticate'(username,password)

```

Dan

---

<div class="post-metadata">

**Author:** ![danpoleary](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/danpoleary/32/2416_2.png) [@danpoleary](https://forum.katalon.com/u/danpoleary)\
**Post date:** [September 25, 2019, 10:49am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/6 "2019-09-25T10:49:31Z")

</div>

I just noticed the single quotes wrapping your JavaScript are the wrong ones. This happens when you copy and paste from here. Change to standard single quotes and you should be fine.

Dan

---

<div class="post-metadata">

**Author:** ![ranjeet.yadav](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@ranjeet.yadav](https://forum.katalon.com/u/ranjeet.yadav)\
**Post date:** [September 26, 2019, 9:17am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/8 "2019-09-26T09:17:40Z")

</div>

Hi @danpoleary  
CC: @katalon_store_suppor, @tech_support

Thank you very much. Your solution resolved my blocker. Thanks for your help.  
Regards,  
Ranjeet

---

<div class="post-metadata">

**Author:** ![jasmi](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jasmi](https://forum.katalon.com/u/jasmi)\
**Post date:** [April 29, 2020, 2:54pm UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/9 "2020-04-29T14:54:05Z")

</div>

Hi,

Will this solution work on Mac as well ?

Best regards  
Jasmi

---

<div class="post-metadata">

**Author:** ![danpoleary](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/danpoleary/32/2416_2.png) [@danpoleary](https://forum.katalon.com/u/danpoleary)\
**Post date:** [April 30, 2020, 10:24am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/10 "2020-04-30T10:24:58Z")

</div>

It should. The window that pops up may be different, so you would have to modify the code to correctly move over and populate the elements on that window.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/katalon/original/3X/d/5/d55596ab02785a255798e87ede769734747b30c4.svg) [@system](https://forum.katalon.com/u/system)\
**Post date:** [April 30, 2021, 10:25am UTC](https://forum.katalon.com/t/unable-to-handle-authentication-pop-up-window-in-ie/10512/11 "2021-04-30T10:25:02Z")

</div>

Closed on April 30, 2021, 10:25am UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
