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: 

Reply
  • 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: 

Children