鼠标停留在重复,点击菜单量角器

时间:2022-09-25 20:22:15

I am new with protractor and I am facing some issues with mouse events. I am trying to hover over one of the ng-repeat items and then click on one of the menu options that they appear on top of each one of them on mouse over. What I tried to do is:

我是量角器的新手,我正面临鼠标事件的一些问题。我试着在一个ng重复项上徘徊,然后点击其中一个菜单选项,它们会出现在鼠标上方的每一个选项上。我想做的是:

var list-element= element.all(by.repeater('element in list'));
list-element.getText().then(function (value) {
            browser.actions().mouseMove(value[0]).perform();
}); 

element.all(by.css('i.icon.x.blue')).then(function(menu-item) {  `
            element(menu-item[0]).click();
});

seems like hovering is not recognized and the element to click on cannot be found.

似乎悬停不被识别,点击的元素不能被找到。

1 个解决方案

#1


3  

You should not be using getText().

您不应该使用getText()。

From what I understand, you should be using something like this:

根据我的理解,你应该使用这样的东西:

var list-element = element.all(by.repeater('element in list')).first();

browser.actions().mouseMove(list-element).perform();
list-element.all(by.css('i.icon.x.blue')).first();

#1


3  

You should not be using getText().

您不应该使用getText()。

From what I understand, you should be using something like this:

根据我的理解,你应该使用这样的东西:

var list-element = element.all(by.repeater('element in list')).first();

browser.actions().mouseMove(list-element).perform();
list-element.all(by.css('i.icon.x.blue')).first();