This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to Connect to HP UFT server from appium

Unable to connect with UFT server with appium with 401 error, kindly advise!

Tags:

Parents
  • 0  

    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

  • 0 in reply to   

    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: 

  • 0   in reply to 


    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

  • 0 in reply to   

    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>

  • Verified Answer

    +1   in reply to 

    What are the capabilities being used?

Reply Children