Unable to connect with UFT server with appium with 401 error, kindly advise!
Cybersecurity
DevOps Cloud
IT Operations Cloud
If an answer to your question is correct, click on "Verify Answer" under the "More" button. The answer will now appear with a checkmark. Please be sure to always mark answers that resolve your issue as verified. Your fellow Community members will appreciate it!  Learn more
Unable to connect with UFT server with appium with 401 error, kindly advise!
Hi Srinivas,
The 401 HTTP code indicates that you're lacking valid authentication credentials. When you connect to the UFT DL embedded Appium server, you need to authenticate. For more info, refer to the Appium capabilities page below:
https://admhelp.microfocus.com/digitallab/en/2023/Content/Appium/Appium_Capabilities.htm
Here is a capabilities example using an execution access key:
{ "appium:appPackage": "com.Advantage.aShopping", "appium:appActivity": "com.Advantage.aShopping.SplashActivity", "uftm:oauthClientId": "oauth2-BCGiOu7x9ZwX43MVnhv4@microfocus.com", "uftm:oauthClientSecret": "rBQS2AyGCjUoq5Jd75Hb", "uftm:tenantId": "999999999", "appium:udid": "712KPBF1100565", "automationName": "UiAutomator2", "platformName": "Android" }
Here is an example using username and password:
{ "appium:bundleId": "com.mf.iShopping", "uftm:userName": "admin@default.com", "uftm:password": "myPassword", "uftm:tenantId": "999999999", "appium:udid": "3ecdf8889a8b18cb3658410d1540f3e6b22a2cb1", "appium:automationName": "XCUITest", "platformName": "iOS" }
Regards,
Alvaro
Hi Srinivas,
The 401 HTTP code indicates that you're lacking valid authentication credentials. When you connect to the UFT DL embedded Appium server, you need to authenticate. For more info, refer to the Appium capabilities page below:
https://admhelp.microfocus.com/digitallab/en/2023/Content/Appium/Appium_Capabilities.htm
Here is a capabilities example using an execution access key:
{ "appium:appPackage": "com.Advantage.aShopping", "appium:appActivity": "com.Advantage.aShopping.SplashActivity", "uftm:oauthClientId": "oauth2-BCGiOu7x9ZwX43MVnhv4@microfocus.com", "uftm:oauthClientSecret": "rBQS2AyGCjUoq5Jd75Hb", "uftm:tenantId": "999999999", "appium:udid": "712KPBF1100565", "automationName": "UiAutomator2", "platformName": "Android" }
Here is an example using username and password:
{ "appium:bundleId": "com.mf.iShopping", "uftm:userName": "admin@default.com", "uftm:password": "myPassword", "uftm:tenantId": "999999999", "appium:udid": "3ecdf8889a8b18cb3658410d1540f3e6b22a2cb1", "appium:automationName": "XCUITest", "platformName": "iOS" }
Regards,
Alvaro
Alvaro, I have defined as below but still getting 401 error,
caps.setCapability("uftm:serverAddress", "https://UFT Server Address:Port/ wd/hub");
// User credentials for HPMC
caps.setCapability("uftm:oauthClientId", oauthClientId);
caps.setCapability("uftm:oauthClientSecret", oauthClientSecret);
caps.setCapability("uftm:tenantId", tenantId);
caps.setCapability("newSessionWaitTimeout", 1000);
caps.setCapability("appium:appPackage", props.getDeviceProperty("androidAppPackage"));
caps.setCapability("appium:AppActivity", props.getDeviceProperty("androidAppActivity"));
In my DriverManager class,
AndroidDriver<RemoteWebElement> driver = null;
driver = new AndroidDriver<>(new URL(cloudUrl+"/wd/hub"), dc.getCaps()); - Connection Refused-org.openqa.selenium.SessionNotCreatedException: