admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

promiseChainRemote do not work #622

Closed meliharici closed 4 years ago

meliharici commented 4 years ago

I can connect to a real device using appium-dekstop from the host working at localhost:8080. I am using exactly the same code which is used in appium-dektop, in a frontend project that will be used on a browser. However, it did not work and I don't know why. Desired capabilities, types and contents of parameters are all the same with the ones used in appium-desktop. Here is the code:

        // desired capabilities are identical with ones used in appium-desktop   
        let desiredCapabilities = {  
            platformName: 'android',
            platformVersion: '6.0.1',
            deviceName: '....',
            udid: '....',
            appPackage: '....',
            appActivity: ....',
            newCommandTimeout: 0,
            connectHardwareKeyboard: true,
            wdNoDefaults: true,
        };
        let host = "127.0.0.1";
        let port = "8080";
        let path = "";
        let username, accessKey; // undefined
        let https = false;
        let rejectUnauthorized = false;
        let proxy = "http://...:...@localhost:8080/wd/hub";

        // all parameters and their types are identical with ones used in appium-desktop 
        let driver = wd.promiseChainRemote({
            hostname: host,
            port,
            path,
            username,
            accessKey,
            https,
          });

         driver.configureHttp({rejectUnauthorized, proxy});

        driver.init(desiredCapabilities).then(res=>{
           console.log(res)
        }).catch(err=>{
            console.log(err)
        })

The error is the following: Unhandled Rejection (TypeError): self._qs.unescape is not a function

It gives the error at " driver.init(desiredCapabilities)".

Please help me. Note that the backend side of the project is actively working on localhost:8080.