Selenium 2.20+ and its interactive hover feature

I want to trigger the :hover effect that is defined in my CSS file using Selenium. Despite it being a common task, none of the methods suggested in previous threads seem to work anymore.

Here are some attempts I've made (unsuccessfully)

  • Selenium-Interface (using WebDriverBackedSelenium) and mouseOver
  • Actions with
    moveToElement(..).build().perform()
  • The RenderedWebElement has been deprecated since version 2.20 and I can't find an alternative for the hover() method it used to provide.

Any new ideas on how to achieve this? Thanks!

Answer №1

Here is a helpful solution recommended by Mark Collin that worked for me. For more details, refer to this link.

Locatable hoverItem = (Locatable) driver.findElement(By.xpath("//a[contains(text(),'Appliances')]"));
Mouse mouse = ((HasInputDevices) driver).getMouse();
mouse.mouseMove(hoverItem.getCoordinates());

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

Why isn't the right-clear property functioning correctly?

My understanding of `clear: left`, `clear: right`, and `clear: both` in CSS has always been a bit fuzzy. I know that `clear: both` means it prevents floating elements from appearing on both sides, but I recently did some testing here. I expected the layout ...

What is the best way to make a Java interface capable of returning an object of a non-primitive type?

Is it true that in Java interface methods can only return primitive types (int, string, etc)? I'm trying to create a method that returns a type "BitMap". However, my IDE is displaying an error saying "Cannot resolve symbol 'BitMap'": publi ...

Present two logos on either side of a navigation bar with Bootstrap in between

I am facing an issue with the display of my two logos. One logo is supposed to be in the right corner and the other in the left, but the right logo is not appearing correctly. <header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="ban ...

What is the best way to place a square inside a rectangle?

I've been experimenting with fitting a square into a rectangle using max-width, max-height, and aspect-ratio. However, I encountered an issue where it only works in portrait mode, but fails in landscape mode. Here is how Firefox renders it: https://i ...

What is the reason behind this HTML/CSS/jQuery code functioning exclusively in CodePen?

I have encountered an issue where this code functions properly in JSFiddle, but not when run locally in Chrome or Firefox. I suspect there may be an error in how the CSS or JavaScript files are being linked. In the Firefox console, I am receiving an error ...

Material-UI's JSS does not adhere to the justify content property

Having trouble aligning elements in my React app using material-ui 1.0 and its JSS solutions. The code I've written below should center justify, but it's not working no matter how I configure it. I suspect there might be a naming issue since mat ...

Achieving a shuffling CSS animation in Angular 8 may require some adjustments compared to Angular 2. Here's how you can make it

Seeking assistance with animating an app-transition-group component in Angular 8. My CSS includes: .flip-list-move { transition: transform 1s; } Despite calling the shuffle function, the animation always happens instantly and fails to animate properly ...

Attempting to change the background color of a table row when hovering in React, but experiencing no success

Describing the appearance of my table row: <tr onMouseEnter={() => {this.buttonIsHovered = true} } onMouseLeave={() => {this.buttonIsHovered = false}} className={this.buttonIsHovered ? 'hover' : null}> The initial value ...

Troubleshooting issue with Bootstrap slider: CSS display problem

After downloading the Bootstrap slider from this link: https://github.com/seiyria/bootstrap-slider, I navigated to \bootstrap-slider-master\dist and transferred the bootstrap-slider.js and bootstrap-slider.min.js files to my js folder. Additional ...

What is the process for creating a two-column table in Angular?

Currently, I have an Angular template code that displays the header on the left and data on the right in a top to bottom layout. <div class="panel-body"> <table class="table table-striped"> <tr ng-repeat="f in fields"&g ...

Activate the JavaScript loader while data is being fetched

I'm currently working on incorporating a loader into my website that should remain visible throughout the entire loading process. For example, if the load time is around 6.8 seconds (with 6.3 seconds of waiting and 0.4 seconds of downloading), I want ...

Displaying static files in a base template using Django is a breeze

Is there a way to link base template with static files from outside the app in Django? I have been trying to figure out how to make static files used by the base template accessible to other templates that inherit from it. I have checked the Django docume ...

Is it possible for a StringBuilder to process a sequence of over 16 empty elements?

Below is the code snippet provided: public class Stringclass { public static void main(String args[]) { StringBuilder s=new StringBuilder(); s.append("v g f j v n x jc kn vd df jdf jkd kfd kfk dfkd lkd fmk dkkdfd kfdkfn kdfd end"); ...

Tips for incorporating a Font Awesome icon <i> within a select dropdown and customizing its appearance

I am facing an issue while trying to insert an icon into a select option. The error message I received is: Warning: validateDOMNesting(...): cannot appear as a child of <option> To indicate that certain fields are required, I am using asterisk ic ...

ElementUnreachableException: unable to interact with the element

My code is designed to autofill a form: from selenium import webdriver driver=webdriver.Chrome('driverchrome//chromedriver.exe') #Open the form driver.get('https://forms.gle/A3qCjSCXi5H64qA26') #Add name driv ...

Can the PHP stylesheet import be configured to exclude a specific string?

Can I import a PHP stylesheet named style.php into my HTML document? Is there a way to delete certain strings from style.php, such as <style> tags, before importing it using traditional methods like <link>? ...

Having difficulty locating xPath in SELENIUM using JAVA

I am facing an issue where I keep getting an error saying that the xpath cannot be found, even though I have set up a loop to wait for this xpath to appear in order to insert data. Despite setting a 60-second time limit for existence, it still fails to fin ...

To make table headers remain stationary as the data scrolls with JavaScript

When using Explorer, I was able to fix the "thead" part of my table while scrolling by using CSS expressions. The following CSS code snippet showcases how it's done: .standardTable thead tr { position: relative; top: expression(offsetParent.scrollTo ...

Encountering difficulties when attempting to click on certain links within a webpage

I have been working on a python script to automate clicking on different categories within a webpage. While I was successful in clicking on the first two categories, I encountered an issue when trying to initiate the final click. I have provided links to i ...

Wrapping a C binary in Java

I am working on a Java program that relies on executing a C binary for certain computations. Currently, I am using a ProcessBuilder to run the C program as an external binary. However, as I am planning to move this program to the cloud, I need to consoli ...