Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98800

Selenium - Can click, getText, etc. on an element except hover

$
0
0

I'm at a complete loss on this one. We have an li element that has a single a element under each. They have no javascript, nor anything unusual about them.

However, trying to hover over one is proving to be impossible! I can click, get text, scroll to, any other action on any of these, but for 3 of the 20 I can NOT do a hover. There are 20 list elements and I can hover over all except 3 of them (elements 5, 10 and 15). I've tried using the li element, using the a element under the li element, many other solutions.

In every case, selenium finds the element and can interact with it in every way except hovering. Any suggestions? Here is the HTML code:

<div id="level1-all-departments" style="display: block;">
<li data-parent="0" id="31447" class="selectedLinkBold">
    <a href="https://this.website.com/holiday.html" aria-expanded="true">Holiday &amp; Seasonal</a>
</li>
<li data-parent="0" id="31356" class="">
    <a href="https://this.website.com/appliances.html" aria-expanded="false">Appliances</a>
</li>
<li data-parent="0" id="31357" class="">
    <a href="https://this.website.com/auto.html" aria-expanded="false">Automotive &amp; Tires</a>
</li>
<li data-parent="0" id="31358" class="">
    <a href="https://this.website.com/baby-kids.html" aria-expanded="false">Baby, Kids &amp; Toys</a>
</li>
<li data-parent="0" id="557612" class="">
    <a href="https://this.website.com/clothing-handbags.html" aria-expanded="false">Clothing, Luggage, &amp; Handbags</a>
</li>
<li data-parent="0" id="31359" class="">
    <a href="https://this.website.com/computers.html" aria-expanded="false">Computers</a>
</li>
<li data-parent="0" id="31360">
    <a href="https://this.website.com/electronics.html" aria-expanded="false">Electronics</a>
</li>
<li data-parent="0" id="252601">
    <a href="https://this.website.com/funeral.html" aria-expanded="false">Funeral</a>
</li>
<li data-parent="0" id="31363">
    <a href="https://this.website.com/furniture.html" aria-expanded="false">Furniture &amp; Mattresses</a>
</li>
<li data-parent="0" id="31361">
    <a href="https://this.website.com/gift-cards-tickets-floral.html" aria-expanded="false">Gift Cards, Tickets &amp; Floral</a>
</li>
<li data-parent="0" id="31362">
    <a href="https://this.website.com/grocery-household.html" aria-expanded="false">Grocery &amp; Household</a>
</li>
<li data-parent="0" id="31365">
    <a href="https://this.website.com/health-beauty.html" aria-expanded="false">Health &amp; Beauty</a>
</li>
<li data-parent="0" id="31366">
    <a href="https://this.website.com/home-and-decor.html" aria-expanded="false">Home &amp; Kitchen</a>
</li>
<li data-parent="0" id="31364">
    <a href="https://this.website.com/hardware.html" aria-expanded="false">Home Improvement</a>
</li>
<li data-parent="0" id="31367">
    <a href="https://this.website.com/jewellery-fashion.html" aria-expanded="false">Jewellery, Watches &amp; Sunglasses</a>
</li>
<li data-parent="0" id="31368">
    <a href="https://this.website.com/office-products.html" aria-expanded="false">Office Products</a>
</li>
<li data-parent="0" id="31369">
    <a href="https://this.website.com/patio-lawn-garden.html" aria-expanded="false">Patio, Lawn &amp; Garden</a>
</li>
<li data-parent="0" id="31489">
    <a href="https://this.website.com/pet-supplies.html" aria-expanded="false">Pet Supplies</a>
</li>
<li data-parent="0" id="31370">
    <a href="https://this.website.com/sports-fitness.html" aria-expanded="false">Sports &amp; Fitness</a>
</li>
<li data-parent="0" id="439601">
    <a href="https://this.website.com/view-more.html" aria-expanded="false">View More Categories</a>
</li>

Here is the code I'm using to successfully hover (I stuck with the index because that removed the most other potential issues, however, I've tried about every other way to identify the element):

@FindBy(xpath = "//div[@id='level1-all-departments']//a[4]/..")
private WebElement listElement;

Actions aAction = new Actions(wDriver);
aAction.moveToElement(listElement).build().perform();

Thanks -Greg


Viewing all articles
Browse latest Browse all 98800


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>