How to Stop Element Flickering While Hovering in Selenium IE Webdriver

My code is functioning perfectly in Firefox, but when I try it on Internet Explorer, there is flickering.
Here is my code:

    WebElement mouseOver= driver.findElement(By.linkText("abc"));
//I'm locating the element by link text. Selenium finds the link text, then I use the Action class to move over it.
    Actions action = new Actions(driver);
    action.moveToElement(mouseOver).build().perform();
    Thread.sleep(1000); 

After the line triggers the action moves to the element, it seems to be stuck in a loop where the cursor keeps moving over the "abc" link text. The flickering prevents it from reaching the next element. I have added a thread.sleep because other items are supposed to display after hovering over the element, which normally takes about 1 second to appear.
I referred to the following link , and it mentioned

The prevailing theory why this occurs is that IE is doing hit-testing of some sort during its event loop, which causes it to respond to the physical mouse position when the physical cursor is within the window bounds.

Does this mean hover will not work in IE? Is there a solution to prevent the flickering?

Answer №1

A few months ago, I encountered a similar issue while automating IE test scripts. It appeared that the computer mouse pointer was trying to gain focus when the focus was already set to the web element. I found a solution by keeping the mouse pointer away from the web page, either in the toolbar or on the taskbar.

You can achieve this manually before initiating the execution or programmatically using Java robot.

Robot r = new Robot();
r.mouseMove(1,1);

Answer №2

If you're in the process of setting up your Driver, consider giving this a shot. It did the trick for me:

DesiredCapabilities newCapabilities = DesiredCapabilities.internetExplorer();
newCapabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
WebDriver driverInstance = new InternetExplorerDriver(newCapabilities);

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

Cookies are not sent by Ajax when used on IE10

After updating to IE10 on my Windows 7 machine, I have been facing an issue with logging into my application. Strangely, this problem did not occur with IE9 and it still works fine with Firefox and Chrome. The main issue seems to be that session cookies ( ...

What is the best way to generate a JavaScript variable using information from SQLite?

I found the examples provided in the JavaScript edition of the Missing Manual series to be extremely helpful! OG.Q. I have explored various options but have not been able to find a solution to my problem yet. This is what I am trying to achieve: Save u ...

Issue of class not found in class path arises when executing my git test via run.bat file in Jenkins

Currently, I am in the process of mastering the execution of eclipse automation code via Git with Jenkins. Interestingly, when I manually run the bat script, everything goes smoothly without any problems whatsoever. However, when attempting to execute it t ...

What are the best ways to personalize the Ant Design table and pagination component?

Is there a way to customize and design table and pagination components? Specifically, I am looking to set the header color of the table as green. How can this be achieved? Similarly, for the pagination component, I want to have a background color on page n ...

The foundation of the Selenium framework seems to be malfunctioning

As a beginner in Selenium, I attempted to create a basic framework that isn't functioning correctly. I utilized TESTNG and DataProvider annotation. If anyone could provide assistance or recommend an alternative framework/code, it would be greatly app ...

Unable to assign a className to a personalized React component - troubleshooting needed!

I have a component that relies on another component. I am trying to pass CSS positioning from the outer component to the inner one by using the following code: import OptionsMenu from './OptionsMenu' import { withStyles } from 'material-ui/ ...

What is the option for receiving automatic suggestions while formatting components in a react.js file?

When styling elements in our app using app.css or styles.css, VS Code provides auto-suggestions. For example, if we type just "back" for background color, it will suggest completions. However, this feature does not work in react.js or index.js. Why is that ...

The cross-domain AJAX request fails to receive a response

I am currently working on validating PAN card details. I am utilizing an AJAX call to verify the PAN card entered by the user, sending the PAN number to this URL: . The data is being sent to the following URL using AJAX call: function callbackFnc(data) { ...

Choosing a single item from multiple elements in React using React and typescript

In this particular project, React, TypeScript, and ant design have been utilized. Within a specific section of the project, only one box out of three options should be selected. Despite implementing useState and toggle functionalities, all boxes end up bei ...

How can recursive data be displayed in a template?

I am working with a model in Django that has a ForeignKey pointing to itself, and I need to display all the data from the database using lists and sublists: Below is my model definition: class Place(models.Model) name = models.CharField(max_length=1 ...

In order to enhance user experience, I would like the tabs of the dropdown in the below example to be activated by

function openCity(evt, cityName) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } ...

Automatically compile files while performing an npm install or update

I am looking for a way to automatically compile my TypeScript code into JavaScript when another project requires it. For example, when a project runs npm install or updates with my project as a dependency, I want a specific command to be executed after all ...

AngularJS does not allow empty spaces in textarea inputs

I am working on a form that includes a textarea element for users to input descriptions, however it does not allow any empty spaces. Users can only input alphanumeric and numeric characters, but no spaces. <textarea class="form-control" rows="4" maxl ...

Preparing my JSON data for visualization on a chart

I have successfully retrieved data using this API, but now I need to transform it into a chart within my react project. As a newcomer to JS and React, I am struggling to create a chart with the JSON data. My objective is to display prices by bedrooms over ...

Issues in the d3.js chart

I'm facing an issue with some incorrect lines appearing in my d3.js chart. Strangely, the problem seems to disappear when I switch tabs on Chrome and return to the chart's tab. It's puzzling to figure out the root cause of this issue, so I ...

Sort the results by total count in Mongoose Express Node.js after grouping by id

I have a unique collection of items: { "_id": { "$oid": "5f54b3333367b91bd09f4485" }, "items": [ { "_id": 20, "name": "Turkish Coffee", "price": ...

Unable to trigger JavaScript function from ASP.NET MVC HTML view

I am encountering an issue with my ASP.NET MVC project where I am attempting to call a JavaScript function to record a user's selection from a listbox. Despite duplicating the JavaScript function in multiple places, it is still not being found. What c ...

What steps can be taken to resolve the "value" parameter exceeding the range error in Protractor?

Currently, I am utilizing Angular 7 in combination with Protractor for end-to-end automated test cases. Additionally, I have incorporated BrowserStack for testing my project across multiple browsers. Within my project, there is an image upload feature for ...

The useEffect hook is able to fetch data even when the state stored in the dependency array remains constant

I have been working on developing a quiz page that utilizes the useEffect hook to fetch data. The data retrieved includes the question as well as multiple-choice options. There is a button labeled Check Answer which, when clicked, reveals the user's f ...

Symfony2 asynchronous validation

Currently, I am utilizing Symfony2 components alongside Doctrine and having no issues with validation on the server side (such as constraints in Entities). However, I am now interested in validating my custom-built form via AJAX without relying on the Symf ...