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!
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 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.
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.PROXY,proxy);
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]")
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!
driver.get(“https://www.example.com”); driver.context(“NATIVE_APP”);
driver.findElement(By.xpath("//*[@type=‘XCUIElementTypeTextField’][@value=‘Login’]")).sendKeys(“Test”);