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
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:
Hi,
The capability "uftm:serverAddress" doesn't exist. Please check the capabilities link provided in my last message.
Since you're using an access key, ensure that it is an execution access key; not a connector key.
Here you can find some sample tests:
https://github.com/uftm-cfrd/appium-samples
Regards,
Alvaro
I checked with few changes in capabilities, now i get 500 error
FATAL com.common.CapabilitiesManager - Failed to load capabilities. ABORT!!org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check t
he server log for more details. Original error: Unable to parse remote response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /wd/hub/session. Reason:
<pre> Server Error</pre></p><hr><i><small>Powered by UFT Mobile://</small></i><hr/>
</body>
</html>
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, Android);
caps.setCapability(MobileCapabilityType.UDID, udid);
caps.setCapability("appium:appPackage", props.getDeviceProperty("androidAppPackage"));
caps.setCapability("appium:appActivity", props.getDeviceProperty("androidAppActivity"));
caps.setCapability("userName", mcUserId);
caps.setCapability("password", mcPwd);....i also tried with oAuth
Please refer to the samples I have provided in the previous comments. You need to add the "uftm:" prefix to the UFTM capabilities.
For more info, check the documentation:
https://admhelp.microfocus.com/digitallab/en/2023/Content/Appium/Appium_Capabilities.htm
In the below link, you may find several code samples as well:
https://github.com/uftm-cfrd/appium-samples
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, platformName);
caps.setCapability(MobileCapabilityType.UDID, udid);
caps.setCapability("uftm:userName", mcUserId);
caps.setCapability("uftm:password", mcPwd);
caps.setCapability("appium:appPackage", props.getDeviceProperty("androidAppPackage"));
caps.setCapability("appium:appActivity", props.getDeviceProperty("androidAppActivity"));
UFT Digital Lab connectors include two embedded Appium servers (1.x and 2.x), so no need to run Appium server separately.
I think it would be of help to open a Support case, so you can get assistance through a virtual meeting.
What is the version of UFT Digital Lab that you're using? Can you send your test?
UFT Digital Lab connectors include two embedded Appium servers (1.x and 2.x), so no need to run Appium server separately.
I think it would be of help to open a Support case, so you can get assistance through a virtual meeting.
What is the version of UFT Digital Lab that you're using? Can you send your test?