Issue with mouse movement in Selenium and Protractor not functioning as expected

Greetings! I am currently facing an issue in my Angular application with Openlayers3 map integration. There is a layer representing a building on the map, and when I try to click on a building during testing, it should trigger a side panel displaying images related to that specific building.

However, the problem arises specifically in Firefox where the test does not seem to function as expected. Has anyone else encountered a similar issue before? Is there a known solution to this problem?

I suspect that the issue might be related to the .mouseMove aspect of my code:

// Within my page object, I have a method

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

And in my test script, I execute:

it('multiple images are linked to the building', function() {
    mainPage.goTo('admin', 'admin');
    var buildingDetailPage = mainPage.buildings().byIndex(0).openDetail();
    browser.waitForAngular();
    buildingDetailPage.clickOnBuilding(1);
    var buildingPanel = buildingDetailPage.getBuildingPanel();
    expect(buildingPanel.countImages()).toBe(3);
});

This functionality works flawlessly in Chrome and Internet Explorer, but encounters issues in Firefox. Any suggestions or insights would be greatly appreciated!

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

Thank you for your assistance!

Answer №1

Here's the method we employ. We utilize numerical values for our X/Y coordinates, rather than an object:

//choose a value using the 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');                    
   });
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

jQuery fieldset.change is a feature that allows you to manipulate

I'm looking to update the value of a button when a radio button is clicked. <fieldset id="product-color"> <input type="radio" id="red" name="color" value="Red"> <label for="red">Red</label><br> <input typ ...

How can I alter the div once the form has been submitted?

Is there a way to change the background of a form and its results after submitting the form? I need to switch the image background to a plain color. I attempted to use a solution I found, but it doesn't seem to be working as expected. You can view my ...

Sending a request from AngularJS to a Django API to retrieve a JWT token results in a 405 error response

After making a POST request to obtain the token in an endpoint that is supposed to accept POST requests, I keep receiving a 405 error. I am working with rest_framework and rest_framework_jwt Here is the code for the endpoint: from django.conf.urls impor ...

Arranging cards in a stack using VueJS

I am currently working with a small vue snippet. Originally, I had v-for and v-if conditions in the snippet, but due to issues reading the array, it is now hardcoded. The current setup produces three cards stacked on top of each other. I am exploring opti ...

Ensure all form fields are validated correctly in AngularJS

What is the most effective method to validate multiple fields in AngularJS? I am working on a form with 7 mandatory fields and I would like to display an error message or change the border color if any of the fields are not valid. I am currently using th ...

What happens when tabs are dynamically added on keypress?

I am encountering issues with this code snippet. $('body').on("keypress", ".message", function(e) { if ( e.keyCode == 13 && $(".message").val().length > 0 ) { input = $(".message"); // Check for join com ...

Tips for testing FormGroupDirective within a component

I am facing difficulties in testing a component with FormGroupDirective in the viewProviders section. I am unable to create a mock of the parent and set an empty formGroup. The component code is as follows: @Component({ (...) viewProviders: [ ...

Adding a PHP file into an HTML page using JavaScript include

Recently, I was assigned to collaborate with a third-party vendor who displays movie times on their platform. We were given the opportunity to co-brand our website on their platform by creating a wrapper for our site. This wrapper would allow the movie tim ...

Activate the jQuery function multiple times

I am currently working on the menu structure for my website <div class="header"> <ul> <li id="menu__lnk_one"><a href="#">Home</a></li> <li><a href="#">Our Story</a></ ...

What is the best way to extract a list of particular items from a nested array?

When I execute the following code: var url="https://en.wikipedia.org/w/api.php?format=json&action=query&prop=categories&titles=Victory_Tests&callback=?"; $.getJSON(url,function(data){ $.each(data, function(i, item) { console.lo ...

Just easy highlighting using tags in Javascript

I have come across a code snippet that seems to be functioning well: <html> <head> <title>Testing JS Highlighting</title> <script type="text/javascript"> function highlight() { var t = ...

Is there a way to transform a Phaser 3 game into an android-game application?

As someone who is new to Phaser, I am curious about the possibility of converting a Phaser game into an Android game. Currently, I am utilizing Phaser with NPM for my projects. Any insights or advice on this matter would be greatly appreciated. Thank you! ...

Modify the variable when a model undergoes alterations

How can I update a variable in my controller when one of the input models changes? I have two separate models for each input field, and I want to merge them into a new variable. However, this new variable does not update automatically when the input models ...

Is it possible to open a PDF file in a new tab using Angular 4?

When attempting to open a PDF file using the window.open() function, I encountered an issue where the window would open and close automatically, causing the file to be downloaded rather than displayed in a new tab. Despite not having any ad blockers inst ...

Extract data from nested JSON and populate a list with corresponding values

<ul> <li><a href="" class="edit">a unique item in the list</a></li> <li><a href="" class="edit">another unique item in the list</a></li> <li><a href="" class="edit">yet another unique ...

Invoking an express route using JavaScript

After successfully defining some routes, including a text input search field at the top of the page, I created a listener function as shown below: $('#tags').keypress(function(e) { if (e.keyCode == 13 && document.getElementById('t ...

Load as soon as the browser is launched

I have developed a unique button that utilizes JavaScript to display the server status through an API. However, I am facing an issue where the server status does not automatically load when the browser is opened for the first time. You need to manually cli ...

Tips for correctly mentioning a user while using message.channel.send in discord.js

Looking for guidance on tagging a user properly using message.channel.send in discord.js? Here's the code I'm currently working with: function replaceAll(str, find, replacer) { return str.replace(new RegExp(find, 'g'), replacer) ...

What could be the reason for a jQuery script failing to execute when included in a PHP include statement from a different PHP page?

I'm currently working with javascript and php to manage cookies across different pages. On one page, I have a script that sets a value in a cookie variable and I want to retrieve that value on another page. Let's say the first page is named page1 ...

What is the best way to implement two events in onPress using React Native?

I'm trying to implement the UploadB function and toggle the modal visibility using setModalVisible(!modalVisible)... However, my attempts so far have not been successful. const UploadB = useCallback(() => { dispatch({ type: ADD_P ...