Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 滑动并单击按钮量角器_Angularjs_Ionic Framework_Protractor - Fatal编程技术网

Angularjs 滑动并单击按钮量角器

Angularjs 滑动并单击按钮量角器,angularjs,ionic-framework,protractor,Angularjs,Ionic Framework,Protractor,我需要刷一个项目,需要在该项目上点击一个按钮,我用这个测试是成功的,但我无法查看该按钮 这个测试用例被写为向左滑动,使一个按钮可见,然后单击该按钮 it('should delete a product',function(){ browser.driver.actions().mouseMove({x:-50,y:0}).perform(); browser.sleep(3000); }); 有人能帮我刷卡吗 删除按钮是 <ion-option-

我需要刷一个项目,需要在该项目上点击一个按钮,我用这个测试是成功的,但我无法查看该按钮 这个测试用例被写为向左滑动,使一个按钮可见,然后单击该按钮

it('should delete a product',function(){
        browser.driver.actions().mouseMove({x:-50,y:0}).perform();
browser.sleep(3000);
            });
有人能帮我刷卡吗 删除按钮是

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

我正在做类似的事情,有离子列表、离子项目和离子选项按钮。我的刷卡功能正常,如下所示:

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()而不是actions()


顺便问一下,水龙头能用吗?为什么不使用ng click?

如果上述使用
tapAndHold
的解决方案不适用于任何人,那么还有另一种解决方案。您还可以使用flickElement

const offset = {x: -50, y: 0};
const targetElement = element(by.css(`selector`)); // This should be the element which is visible on your screen and you want to swipe
await browser.driver.touchActions()
    .flickElement(targetElement, offset, 200)
    .perform();
上面的代码是向左滑动元素。 要向右滑动,您可以使用:

const offset = {x: 50, y: 0};

滑动操作是否成功,而您无法对元素执行单击操作?或者您不能同时执行滑动和单击操作?是的,我无法执行滑动操作我的终端显示成功,但在我的浏览器中,我看不到任何由量角器执行的滑动操作。您在哪个平台上运行上述测试?这是在IOS模拟器中,还是仅仅在普通的Chrome浏览器中?当我尝试使用此方法时,我不断收到“尚未实现方法”错误…另外,您使用的是什么版本的量角器/硒服务器/铬驱动程序?它不适用于ios模拟器,收到尚未实现的错误tapAndHold方法