Handle HTTP Authentication on iOS Safari

Hey guys,

Is there a way of inputing the username/password of an http authentication using Appium on Safari iOS? The pattern http://username:[email protected] doesn’t work, and I can’t find a way of inputing user/pass on the pop up dialog. Please help me!


1 Like

Can you explain what “doesn’t work” means? Please give us details so we can identify your problem.

When you access a website that has a http authentication (example: integration.westelm.com ), it pops up a dialog asking for username and password, but Appium doesn’t provide a way of filling this automatically, so we’re not able to perform tests on this website.

Thanks for the help


Do you use Selenium Proxy or Browser mob proxy?

Unfortunately I have no answer to the question how Appium works with this features. :frowning:

I want to know it too.
There is the similar topic. So it is possible that there are some problems.

Thanks for the answer @SergeyTichomirov . Actually I don’t use proxies yet, but I’ll take a look. Anyway, it would be great if Appium could fill the authentication pop up on iOS. I believe that isn’t a hard thing to do anyway.

Do you have any solution for handle the authentication on IOS Safari, I am also facing the same issue

I am using Browser Mob Proxy (version 2.1.0 beta-1), Appium (1.3.6) with Appium provided Java client (ver: 2.1) library. But Appium failed to set Proxy when start AppiumDriver and returning ‘Original error: Instruments never checked in’ exception. I tested on iphone-simulator on iOS 8.1.
Setting Proxy using below code
Proxy proxy = BMP_Proxy_Controller.Server.seleniumProxy();
objCapabilities.setCapability(MobileCapabilityType.ACCEPT_SSL_CERTS, true);

Log captured from Appium server:
{“desiredCapabilities”:{“orientation”:“Portrait”,“acceptSslCerts”:true,“browserName”:“Safari”,“autoLaunch”:true,“locale”:“US”,“safariAllowPopups”:true,“locationServicesAuthorized”:true,“newCommandTimeout”:“600000”,“autoAcceptAlerts”:true,“safariIgnoreFraudWarning”:true,“platformVersion”:“8.1”,“fullReset”:false,“deviceName”:“iPhone 5”,“platformName”:“iOS”,“proxy”:{“noProxy”:null,“socksUsername”:null,“httpProxy”:“NDI-LAP-371.3pillar.corp:8019”,“ftpProxy”:null,“socksPassword”:null,“sslProxy”:“NDI-LAP-371.3pillar.corp:8019”,“proxyAutoconfigUrl”:null,“proxyType”:“MANUAL”,“class”:“org.openqa.selenium.Proxy”,“autodetect”:false,“hCode”:1056099159,“socksProxy”:null},“bundleId”:“com.apple.mobilesafari.app”,“deviceReadyTimeout”:“450”,“locationServicesEnabled”:false}}
info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : acceptSslCerts, proxy,

Hey guys, I found the solution to access http authentication websites. It’s actually kind of weird but it works:

Before accessing the http authentication protected website, ask selenium to go to page ‘a’, and then send the goto to users/[email protected], like this:

  browser.goto('a') #appium workaround for the http authentication to work
  browser.goto("http://username:[email protected]")


Please help me any one on the below issue, Thanks in advance.

Issue: once hit url on the mobile(Real Device) safari browser,it pops up a dialog asking for username and password.

I am unable to communicate with popup and also I tried below ways but not working.

driver.get(“https://username:[email protected]”)
2. driver.get(“https://username:[email protected]”);

    Alert aa = driver.switchTo().alert();
    Robot a = new Robot();
    Alert bb = driver.switchTo().alert();


Please tell me, is it possible to auto fill the data into the text fields using appium.


I decided to try this out now that XCUITest is in use. I found a good demo page and the results were great:

driver.findElement(By.id("Log In")).click();


driver.get("https://aerobatic:[email protected]/protected-standard");

both worked well. Just remember to go back to WEBVIEW context, if you decide to go through the first way of doing this.

1 Like

Do you have now any solution for handle the authentication for chrome mobile browser, I am not able to handle please help.

Hi @SumitSharma, Fir chrome mobile browser, simply use http://username:[email protected] and it will work without any issue

thanks man!
This was extremely helpfull!
unfortunatelly the solution with login and passwort in URL did not work for the iOS Safari.

alert did not work too

working with elements started to work when I have changed to the native!