使用appium无法在量角器脚本中定位元素 [英] Element could not be located in protractor scripts using appium

查看:73
本文介绍了使用appium无法在量角器脚本中定位元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Ipad Air模拟器,appium和量角器自动化对Angular JS站点的测试,但是无法成功通过测试的问题是,它告诉我找不到元素,我确定关于xpath,它是由appium生成的.

I want to automate my tests for an Angular JS site using Ipad Air simulator, appium and protractor but the problem that the test couldn't be passed successfully, it tells me that element couldn't be located and i'm sure about the xpath it's the same generated by appium.

这是我的配置文件

​exports.config = {
  allScriptsTimeout: 600000,
  seleniumAddress: 'http://0.0.0.0:4723/wd/hub',

  specs: [
    'testsuite/test3.js'
  ],

  capabilities: {
    browserName: 'safari',
   'appium-version': '1.4.13',
    platformName: 'iOS',
    platformVersion: '9.3',
    deviceName: 'iPad Air'
},

  chromeOnly: false,

  baseUrl: 'http://urlofmyapp',

  frameworks:[
    'jasmine'
  ],

mochaOpts: { 

    defaultTimeoutInterval:1000000
}         
}; 

我的test3.js文件包含:

My test3.js file contain :

"use strict";
var wd = require("wd");
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");

chai.use(chaiAsPromised);

var expect = chai.expect;

chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

describe('my app', function() {

it('should make the login test',function()  {

var desired = {
browserName: 'safari',
platformName:'iOS',
name:"This is an example for login test"
}
browser.ignoresynchronization=true;
browser.get("theurlofmyapp");


 browser.driver.findElement(by.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]")).sendKeys("RET02");


});

});

在运行时出现错误

量角器protractor.config.js

protractor protractor.config.js

推荐答案

browser.driver.findElement更改为browser.findElement

这篇关于使用appium无法在量角器脚本中定位元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆