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

Guide on configuring the AutoIt path in Python

I am encountering an issue while trying to automate file uploads using the AutoIt library in combination with Selenium and Python. When executing the code, I receive the following error message: from .autoit import options, properties, commands File &quo ...

Error: Unable to access 'price' property of undefined - Next.js version 14.0.1

I'm encountering an issue with Next.js where my code is not working as expected. Interestingly, the same code works perfectly fine in other templates. let subTotal = 0 if (selectedProducts?.length) { for (let id of selectedProducts) { ...

What is the functionality of named function expressions?

After coming across an intriguing example in the book labeled as a "named function expression," I was curious to delve into its mechanics. While the authors mentioned it's not commonly seen, I found it fascinating. The process of declaring the functi ...

What strategies can be employed to reduce the need for numerous if-else statements in my JavaScript code?

In my input form, users have the ability to make edits. I need to send only the data that has been changed by the user. Currently, I am repeating the same lines of code multiple times to compare and determine what data needs to be sent. Is there a more e ...

Passing references using a personalized component

So, I've encountered this issue with my code: import MuiDialog from "@mui/material/Dialog"; import { styled } from "@mui/material/styles"; const TheDialog = styled((DialogProps) => ( <MuiDialog {...DialogProps} /> ))(( ...

No data is being recorded in the Firestore database

This component in nextjs is designed to write data to a firestore database after the user clicks a button. Unfortunately, Firebase seems to be having trouble writing the data, even though the alert message following the supposed data dump is successful. I ...

most efficient method of sharing information between various angular controllers

I am looking for a way to share form data among multiple controllers before submitting it. Currently, I am using module.value() to store the data as a global variable. var serviceApp = angular.module('sampleservice', [ ]); serviceApp.valu ...

Track your status with jQuery technology

I have a link: <a href="/test/number/3/phone/0">33df</a> Is there a way to determine if the words 'number' and 'phone' are present in this link? I am looking for a function similar to: check('number', ' ...

After a span of two minutes, the Node.js and Express server terminates the connection

I am currently working with Express 4.X and Node.js 0.12. One of the routes in my application is responsible for uploading and processing files. However, I have encountered an issue where some file uploads are taking longer than the default 2-minute timeo ...

Learn the steps to dynamically adjust the size of a pop-up window in Sencha based on the content that is

This is the designated container where I plan to display text. The code resides within a modal (pop-up) and it's important for the pop-up to adjust its height based on the loaded text. Ext.define('Base.view.Notes', { extend: 'Ext.Co ...

I'm looking to configure @types for a third-party React JavaScript module in order to use it with TypeScript and bundle it with webpack. How can I accomplish this?

Imagine you have a third-party npm package called @foo that is all Javascript and has a module named bar. Within your TypeScript .tsx file, you want to use the React component @foo/bar/X. However, when you attempt to import X from '@foo/bar/X', y ...

jQuery does not function properly when used with string variables

Why am I experiencing different results in Google Chrome when using a hard-coded string versus storing the same string in a variable? While the hard-coded string works properly, the same string stored in a variable does not produce the expected outcome. ...

Discovering the process of retrieving API data upon a button click within Next.js using server-side rendering

Hi there, I'm fairly new to working with next.js and would greatly appreciate some assistance. I am trying to figure out how to fetch data from an API upon clicking a button in next.js on the server side. I understand that using onClick directly is ...

If the text is too lengthy, enclose it within a div element

I am facing an issue with a fixed width DIV of 300px. Within this DIV, I have dynamic text that sometimes exceeds the width and gets cut off. Is there a way to make the text wrap when it exceeds the 300px limit without increasing the height of the DIV? Is ...

What could be causing the return of undefined upon execution?

function updateTitle(title) { title = "updated title"; } var currentTitle = "original title"; currentTitle = updateTitle(currentTitle); console.log(currentTitle) I'm just starting to learn JavaScript and I'm curious about why this code behav ...

Ways to attach the close event to the jquery script

Hello, I'm having trouble reloading the parent page when the close button is clicked on a modal dialog. Here's my code snippet: //customer edit start $( ".modal-customeredit" ).click(function() { var myGroupId = $(this).attr('data- ...

VueJS - The application is unable to find the designated route

I've encountered an issue with the Signin page in my project. Despite having all other pages functioning properly, the Signin page doesn't seem to render anything when I navigate to it (http://localhost:8080/#/signin). import Vue from 'vu ...

show information on a separate screen following the selection of a choice

After selecting an option, how can I make #formid appear where the form is filled in with the stock selected in the option section? <div class="form-group"> <label for="exampleFormControlSelect1">Item Name</label> <select clas ...

The functionality of the back button in a JavaScript website only allows users to navigate through their browsing

I'm currently experiencing an issue with the back navigation button on my one-page website. When I load a new page, I use the following code snippet: displayPage = function (page, json) { var stateObj = { "page": page, 'json': j ...

Divide a string into smaller sections beginning at " ] " and concluding with "As"

In Microsoft SQL Server 2008 R2, I have fetched a string from a stored procedure using the query: EXEC sp_helptext 'MyStoredProcedureName';. My task is to divide this string into arrays or substrings that start from the closing parenthesis "]" a ...