protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Does Protractor + Appium works for Native or Hybrid apps

Open nainighai opened this issue 11 years ago • 23 comments

Was able to develop and execute Protractor successfully for web apps on desktop as well as Android. but faced issues with Native / Hybrid apps (based on PhoneGap).

Configuartion file:-

conf_mobile.js exports.config = { seleniumAddress: 'http://localhost:4723/wd/hub',

specs: ['example_spec_mobile.js'],

// Reference: https://github.com/appium/sample-code/blob/master/sample-code/examples/node/helpers/caps.js capabilities: { browserName: '', 'appium-version': '1.0', platformName: 'Android', platformVersion: '4.4.2', deviceName: 'Android Emulator', app: 'path to APK file' },

allScriptsTimeout: 60000 };

Specification File:- describe('homepage', function() { it('validate service url', function() { element(by.id('com.test.testApp:id/clearable_edit')).sendKeys('URL to type in text field'); element(by.id('com.test.testApp:id/serviceUrlButton')).click(); }); });

Error logs:- D:\nodejs\node_modules\protractor\example>protractor conf_mobile.js Using the selenium server at http://localhost:4723/wd/hub [launcher] Running 1 instances of WebDriver

D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113 var template = new Error(this.message); ^ UnknownError: Not yet implemented. Please help us: http://appium.io/get-involved.html at new bot.Error (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113:18) at Object.bot.response.checkResponse (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9) at D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:362:20 at D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1582:15 at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js: 1654:20) at notify (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:465:12) at notifyAll (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:442:7) at resolve (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:420:7) at [object Object].fulfill (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:535:5) at D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1520:10 ==== async task ==== WebDriver.manage().timeouts().setScriptTimeout(60000) at webdriver.WebDriver.schedule (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:345:15) at webdriver.WebDriver.Timeouts.setScriptTimeout (D:\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:1301:23) at Runner.createBrowser (D:\nodejs\node_modules\protractor\lib\runner.js:180:30) at D:\nodejs\node_modules\protractor\lib\runner.js:259:24 at _fulfilled (D:\nodejs\node_modules\protractor\node_modules\q\q.js:797:54) at self.promiseDispatch.done (D:\nodejs\node_modules\protractor\node_modules\q\q.js:826:30) at Promise.promise.promiseDispatch (D:\nodejs\node_modules\protractor\node_modules\q\q.js:759:13) at D:\nodejs\node_modules\protractor\node_modules\q\q.js:525:49 at flush (D:\nodejs\node_modules\protractor\node_modules\q\q.js:108:17) [launcher] Process exited with error code 1

nainighai avatar Feb 10 '15 18:02 nainighai

Any update, as we need to take the decision on what choice of language / tool to use. With Java Client libraries it is do able to automate Native Apps (Selenium WebDriver + TestNG + Appium), but does not seems to be working with protractor.

nainighai avatar Feb 11 '15 09:02 nainighai

Nope, as said, it is not yet implemented. We have a team TODO for this.

juliemr avatar Feb 15 '15 06:02 juliemr

Thanks for your response.

Can you also let us know what is the ETA to bring in support for Native / Hybrid apps?

nainighai avatar Feb 16 '15 04:02 nainighai

Testability for hybrid apps running in WebViews is somehow critical and - at least for me - a show-stopper, if not possible. So it is good to read that there is a team TODO for this. Unfortunately an existing TODO does not mean that it will be implemented soon - that's why i would be very happy if a rough statement about the plans on implementing this appears :)

napolitano avatar Mar 09 '15 15:03 napolitano

See https://github.com/angular/protractor/issues/1940

juliemr avatar Mar 18 '15 00:03 juliemr

Hi juliemr..may i know when is the release date for using protractor for hybrid apps runs in webview..in our project we need to finalize the tool.

csharsha avatar Mar 26 '15 07:03 csharsha

Please your help: http://stackoverflow.com/questions/30480452/cant-run-test-script-by-appium-on-node-js

idaneliz avatar Jun 02 '15 11:06 idaneliz

@idaneliz Please have a look on you'r question at stackoverflow.

napolitano avatar Jun 03 '15 10:06 napolitano

@nainighai how did you setup to be able to test against Android using protractor? can you please share what you've done?

Thanks

bmsoko avatar Jun 10 '15 15:06 bmsoko

hi all, when ever you are trying to run an apk file directly in to the device and run the test cases through protractor , check that apk you generated should be either in dev or debug stage not in release. Was facing the same issue and resolved it by changing it to either dev or debug stage./

Hope this works.

imsushree avatar Sep 05 '17 04:09 imsushree

Hi, I am trying to run Protractor tests by launching a Hybrid app on a mobile emulator. My app is getting launched but then it is getting closed with the error message: 'WebDriverError: No such context found'. I have already included autoWebview: 'true' in my conf.js file Any solution on this would be really helpful.

ssudhanshu avatar Sep 20 '17 09:09 ssudhanshu

@ssudhanshu

Your question is better suited for StackOverflow or Gitter. Please ask a question there with the 'protractor' tag or post in the Gitter Channel to get help.

From the the getting help section of the README:

Please ask usage and debugging questions on StackOverflow (use the "protractor" tag) or in the Angular discussion group. (Please do not ask support questions here on Github.)

Thanks!

wswebcreation avatar Sep 20 '17 09:09 wswebcreation

Thanks @wswebcreation

ssudhanshu avatar Sep 20 '17 09:09 ssudhanshu

@wswebcreation is protractor still not supporting for Native App automation?

babusurendra avatar Oct 27 '17 13:10 babusurendra

@babusurendra

True, no native support

wswebcreation avatar Oct 27 '17 16:10 wswebcreation

Hi, I am trying to run Protractor tests by launching a Hybrid app on a mobile emulator. My app is getting launched but then it is getting closed with the error message: 'ERROR - Unable to start a WebDriver session.' Any solution on this would be really helpful.

kommuswamy avatar Oct 31 '17 09:10 kommuswamy

@wswebcreation, Please let me know if it is possible to test Hybrid mobile app (not a web app) using Protractor + Appium.

kommuswamy avatar Oct 31 '17 09:10 kommuswamy

Hi @kommuswamy

It is possible, only when your hybrid app starts with a Webview. The error you describe is a configuration error. SO or Google can help you with that.

wswebcreation avatar Oct 31 '17 09:10 wswebcreation

Hi @kommuswamy

I was also facing the same issue. Generally, that WebDriver session issue comes when you have a WebView in your app and you have not switched to it. Hybrid apps contain WebViews. You need to switch to them in order to work on it. Try adding below lines to your config file: autoWebview: 'true',
autoWebviewTimeout: '10000',

ssudhanshu avatar Oct 31 '17 09:10 ssudhanshu

Hi @ssudhanshu, I am facing same error which you mentioned above "No such context found." after adding the autoWebview: 'true', in my conf.js file. I am seeing the following context are available when I ran the script Available contexts: ["NATIVE_APP","WEBVIEW_com.****.mobile.prod"] did you file any request in StackOverflow or gitter?

kommuswamy avatar Oct 31 '17 10:10 kommuswamy