自动在文本框中键入文本,然后单击iOS上的按钮

时间:2015-08-12 08:57:52

标签: ios automation ionic-framework

我使用Ionic Framework(https://appsto.re/cn/EY8s7.i)创建了一个iOS应用程序。是否可以模拟该应用程序的用户输入?

例如,用户点击我的应用程序中的QQ登录按钮,我的应用程序在应用程序内浏览器中打开facebook身份验证页面。现在,我希望应用程序自动将用户名和密码填入验证窗口,然后点击“登录”按钮。

我怎样才能实现它?

1 个答案:

答案 0 :(得分:0)

我想你想完成这个测试你的应用程序及其一些功能吗?

如果是这样,您应该使用Angular Protractor进行此类测试。

  

Protractor是一个Node.js程序,运行端到端测试,这些测试也是用JavaScript编写的,并与节点一起运行。量角器使用WebDriver来控制浏览器并模拟用户操作。

以下是一个例子:

describe('TODO list', function() {
    it('should filter results', function() {

        // Find the element with ng-model="user" and type "jacksparrow" into it
        element(by.model('user')).sendKeys('jacksparrow');

        // Find the first (and only) button on the page and click it
        element(by.css(':button')).click();

        // Verify that there are 10 tasks
        expect(element.all(by.repeater('task in tasks')).count()).toEqual(10);

        // Enter 'groceries' into the element with ng-model="filterText"
        element(by.model('filterText')).sendKeys('groceries');

        // Verify that now there is only one item in the task list
        expect(element.all(by.repeater('task in tasks')).count()).toEqual(1);
    });
});

有关此事的更多信息,请访问AngularJS end-to-end testing