简体   繁体   中英

mouseMove not working with Selenium and Protractor

Hi in an Angular application I have an Openlayers3 map on which I have a layer which represents a building. In my test I am trying to click on one of these buildings which triggers a sidepanel with images linked to this building.

The problem is that only in Firefox my test does not seem to work. I was wondering if anyone else has stumbled upon this problem and if their is a solution.

My guess is it has something to do with the .mouseMove my code :

// I have a page object which has a method

this.klikOpGebouw = function(gebouwId) {
    return browser.executeScript("return angular.element(document.querySelector('#map')).scope().map.custom.getPixelForGebouw(" + gebouwId + ")").then(function(pixel){
        return browser.actions()
            .mouseMove(element(by.id("map")).getWebElement(), {x: pixel[0], y: pixel[1]})
            .click()
            .perform();
    });
};

And in my test I do :

it('er zijn verschillende afbeeldingen gekoppeld aan het dossier', function() {
    mainPage.goTo('admin', 'admin');
    var dossierDetailPage = mainPage.dossiers().byIndex(0).openDetail();
    browser.waitForAngular();
    dossierDetailPage.klikOpGebouw(1);
    var gebouwPanel = dossierDetailPage.getGebouwPanel();
    expect(gebouwPanel.countAfbeeldingen()).toBe(3);
});

In chrome and internet explorer this works perfectly. Only in Firefox it goes fubar. Any ideas ?

Selenium driver : 2.47.1
AngularJS : 1.3.4
karma : 0.12.16
karma-jasmine: 0.2.2

Kind regards

This is how we do it. The difference is that we use numbers for our X/Y coordinates, not an object:

//select a value with mouse
popup.getLocation().then(function (position) {
   popup.getSize().then(function (dimension) {
      browser.actions().
      mouseMove(popup, 0, 150).
      click().
      perform();
      expect(input.getAttribute('value')).toBe('id_3');                    
   });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM