量角器和Appium总是开始镀铬

时间:2017-01-13 12:01:36

标签: protractor appium

我正在尝试在iOS模拟器/ Genymotion Android模拟器上使用Appium运行Protractor测试。对于这个问题,让我们坚持使用iOS,不管吗?

  1. 我按照Protractor页面here上的步骤进行操作。
  2. 您会注意到Appium安装的网址不起作用,因此here是正确的。
  3. 基本上,您只需要webdriver-manager update --ios
  4. 运行webdriver-manager start --ios,它将自动启动appium
  5. 量角器配置文件:
  6. `

    'use strict';
    
    exports.config = {
      seleniumAddress: 'http://localhost:4723/wd/hub',
    
      capabilities: {
        app: '/Users/aaa/Projects/bbb/platforms/ios/build/emulator/mobileCRM.app',
        browserName: 'safari',
        platformName: 'iOS',
        platformVersion: '9.3',
        deviceName: 'IPad Simulator',
      },
    
      baseUrl: 'http://10.0.2.2:3000',
    
    
      // Spec patterns are relative to the current working directly when
      // protractor is called.
      specs: ['./test/protractor/**/*.js'],
    
      /* configuring wd in onPrepare
       * wdBridge helps to bridge wd driver with other selenium clients
       * See https://github.com/sebv/wd-bridge/blob/master/README.md
       */
      onPrepare: function () {
        var wd = require('wd'),
          protractor = require('protractor'),
          wdBridge = require('wd-bridge')(protractor, wd);
        wdBridge.initFromProtractor(exports.config);
      }
    };
    

    `

    1. 启动量角器:./node_modules/protractor/bin/protractor protractor.conf.js
    2. 预期? 应该启动iOS模拟器,

      会发生什么? 量角器测试始终在Chrome中开始。那么,我做错了什么?

      加成: `

      ./node_modules/protractor/bin/webdriver-manager status     
      [13:01:05] I/status - selenium standalone version available: 2.53.1 [default] [last]
      [13:01:05] I/status - chromedriver version available: 2.26 [default] [last]
      [13:01:05] I/status - geckodriver version available: v0.12.0 [default] [last]
      [13:01:05] I/status - appium version available: 1.6.0 [default] [last]
      [13:01:05] I/status - android-sdk is not present
      

      `

1 个答案:

答案 0 :(得分:1)

Setting Up Protractor with Appium - iOS / Safari部分的底部,它注意到以下内容:

baseUrl is localhost (not 10.0.2.2)