滑动并单击按钮量角器 [英] swipe and click a button protractor

查看:161
本文介绍了滑动并单击按钮量角器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要刷一个项目,需要点击该项目中的按钮,我用这个测试成功但我无法查看该按钮
这个测试用例被写入左侧滑动并按下按钮可见并点击该按钮

i need to swipe an item and need to click on a button in that item, i used this the test is success but i could not view that button this test case is written to swipe left and make a button visible and click on that button

it('should delete a product',function(){
        browser.driver.actions().mouseMove({x:-50,y:0}).perform();
browser.sleep(3000);
            });

有人可以帮助我刷
删除按钮

could someone help me to swipe the delete button is

<ion-option-button ng-show="!userService.isOffline" class="button button-assertive button disable-user-behavior" on-tap="deleteLead(leads)">Delete</ion-option-button>


推荐答案

我正在做一些与离子列表类似的事情,带有离子项和离子选项按钮。我的滑动工作,看起来像这样:

I am doing something similar, with an ion-list, with ion-items, and ion-option-buttons. My swipe works, and looks like this:

var elements = element(by.id("item-list")).all(by.tagName("ion-item"));
var item1 = elements.get(0);
item1.getLocation().then((location) => {
  var startLocation = {
    x: location.x + 300,
    y: location.y + 50
  }
  var newLocation = {
    x: startLocation.x - 100,
    y: startLocation.y
  };
  browser.driver.touchActions()
                .tapAndHold(startLocation)
                .move(newLocation)
                .perform();
}

所以我认为你应该使用touchActions()而不是action()

So I think you should use touchActions() instead of actions()

顺便说一句,是否有工作?为什么不使用? ng-click?

By the way, does on-tap work? Why not using ng-click?

这篇关于滑动并单击按钮量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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