1

I want to execute protractor script on android emulator using Appium, but the problem emulator isn't launched when i tap: " protractor conf.js " on terminal. The test is passed in chrome browser of windows instead of browser in the emulator. Shall i add other capabilities ? or i should change the base url ?

// An example configuration file.
exports.config = {
  seleniumAddress: 'http://localhost:4733/wd/hub',
    specs: ['todo-spec.js'],
    directConnect: true,

  // Capabilities to be passed to the webdriver instance.
  capabilities: {

  'browserName': 'chrome',
      'device': 'android',
      'deviceName' : '5554:AndroidDevice',
       device: 'android',
    'appium-version': "1.4.16.1",
    deviceName : '5554:AndroidDevice',
  },

  // Framework to use. Jasmine is recommended.
  framework: 'jasmine',
 baseUrl: 'http://127.0.0.1:5858',
  // Spec patterns are relative to the current working directly when
  // protractor is called.


  // Options to be passed to Jasmine.
  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};

//------------------todo-spec.js----------------------------------------
describe('angularjs homepage todo list', function() {
    it('should add a todo', function() {
        browser.get('https://angularjs.org');

        element(by.model('todoList.todoText')).sendKeys('write first protractor test');
        element(by.css('[value="add"]')).click();

        var todoList = element.all(by.repeater('todo in todoList.todos'));
        expect(todoList.count()).toEqual(3);
        expect(todoList.get(2).getText()).toEqual('write first protractor test');

        // You wrote your first test, cross it off the list
        todoList.get(2).element(by.css('input')).click();
        var completedAmount = element.all(by.css('.done-true'));
        expect(completedAmount.count()).toEqual(2);
    });
});
Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77

1 Answers1

1

Remove the directConnect to allow it to use the selenium server:

// An example configuration file.
exports.config = {
  seleniumAddress: 'http://localhost:4733/wd/hub',
  specs: ['todo-spec.js'],
  directConnect: true,  <-- remove this line

  ...
} 

A related topic that should help clearing things up:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • When i removed this line : " directConnect: true", it's ok i got the emulator while starting appium. But the problem is that emulator is not responding always – Emna Ayadi Mar 14 '16 at 15:47