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

查看:26
本文介绍了无法在使用 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天全站免登陆