Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

moveToElement() method of Actions class is not working in selenium 2.37 #6468

Open
lukeis opened this issue Mar 4, 2016 · 13 comments
Open

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 6468

What steps will reproduce the problem?
My webpage has a dropdown ul contains 10 li elements. first 4 li elements only visible.
remaing 6 li elements can be visible by scrolling only.
selenium can't click invisible elements. To make li element visible, I used to scroll
using method moveToElement() of Actions class. So that we can click element.

WebElement element= ....; //this is the li element which is invisible in dropdown ul
Actions builder = new Actions(firefoxDriver);
builder.moveToElement(element).build().perform();
element.click();

this code is working fine selenium 2.32 with Firefox 22.
But After upgrading selenium to version 2.37 with Firefox 24.0, It is not working.


What is the expected output? What do you see instead?
after using moveToElement(element), element should be visible.
But still element is not visible. so element can't be clickable.


Selenium version: 2.37
OS: Ubuntu 12.10
Browser: Firefox
Browser version: 24.0


Reported by perineedi.gangadhar on 2013-10-24 15:15:15

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Ha! I'm currently investigating the same issue.  For me it's Selenium 2.32 and FF 17
to 2.37 and FF 24.

Reported by jmleyba on 2013-10-24 16:02:11

  • Status changed: Accepted
  • Labels added: Component-WebDriver, Browser-Firefox
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

And, by the way, provide an executable scenario and a sample page to reproduce the issue.

Reported by barancev on 2013-10-24 19:23:26

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I've reported a similar issue for ChromeDriver at https://code.google.com/p/chromedriver/issues/detail?id=605.
It works for me on WebDriver 2.37 & FF 24 though.

Reported by ilynaf on 2013-11-05 03:30:35

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I'm seeing either the same or very similar issue with 2.37 and Firefox 24 & 25

For me the following testcase scrolls in 24 and does not scroll in 25:
import java.io.File;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.interactions.Actions;

public class Example {
    @Test
    public void ExampleTest() {
        FirefoxProfile p = new FirefoxProfile();
        FirefoxDriver driver = new FirefoxDriver(new FirefoxBinary(new File("C:\\FF-Selenium_\\firefox.exe")),
p);
        driver.get("http://code.google.com/p/selenium/");
        WebElement link = driver.findElement(By.linkText("Terms"));

        Actions builder = new Actions(driver);
        builder.moveToElement(link).build().perform();
    }
}

Obviously for the scrolling to happen the window/screen must be small enough that the
Terms link appears below the fold. I also saw it fail with 2.36 so it seems to be tied
to Firefox version change. 2.37 with Firefox 24 scrolls this testcase for me.

Reported by merikes on 2013-11-08 11:06:17

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Same issue faced by me too. I used webDriver 2.37 and FF24. Eagerly waiting for the
fix :)

Reported by nidhish.narayanan on 2013-11-22 13:31:19

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi,
     I'm facing exactly similar issue with Dropdown options , the ones which are not
in the view.

I have tried alternatives but didn't help :(  - 

1. IMouse mouse = ((IHasInputDevices)WebDriver).Mouse;
mouse.MouseMove(item.Coordinates);

2. ILocatable item = (ILocatable)option.ControlWebElement;
System.Drawing.Point p = item.LocationOnScreenOnceScrolledIntoView;



Environment - 
Os : Win 7 , 64 bit
Selenium 2.37 C# bindings
Firefox 23,26
IE - 10

Reported by rupam08 on 2014-04-03 20:01:32

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

@rupam08
By using JavaScriptExecutor, if you run jQuery mouseover() on a dropdownOption which
is not in view Then the option may come into the view.
Example: selenium.executeScript("jQuery(\".optionSelector\").mouseover();");
It worked for me as a workaround.

Reported by perineedi.gangadhar on 2014-04-14 10:27:17

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I used contextrightclick to make it visible, avoided moveto for now, worked

Reported by fevllfti on 2014-04-25 17:40:57

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I thought of the javascript option, however  I'm running tests in parallel on multiple
instances of different browsers, hence if I give control outside webdriver I think
might face browser focus issue.

Please let me know if for anyone running javascript on parallel browser instances had
any -ve effects or not.

Reported by rupam08 on 2014-04-25 22:19:12

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by jmleyba on 2014-05-26 20:51:35

  • Status changed: New

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I got similar challenge with my project. But as I was fiddling with different methods
I found this solution below:

I simply added a .click() method as:
WebElement element= ....; //this is the li element which is invisible in dropdown ul
Actions builder = new Actions(firefoxDriver);
builder.moveToElement(element).click().build().perform();

Hope this helps

Samson Ojo

Reported by samson.ojo on 2015-01-21 11:27:49

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi Friends..


moveToElement is not working in my FF 35.0.1 and selenium 2.44.0 below is the code
Colud any one please help on this

package com.selenium.training;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;

public class action1 {

    public static WebDriver driver;
    public action1()
    {
        driver=new FirefoxDriver();
    }

    @Test
    public void facebook()
    {
        driver.navigate().to("https://facebook.com");
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(5000,TimeUnit.SECONDS);
        WebElement username=driver.findElement(By.id("email"));
        System.out.println(username.getSize());
        //username.sendKeys("Mahesh");
        Actions builder=new Actions(driver);
        builder.moveToElement(username,150,22);
        builder.sendKeys("Mahesh");
        builder.perform();
        Action seriesofactions=builder.moveToElement(username).click().keyDown(username,Keys.SHIFT).sendKeys(username,"hell").keyUp(username,Keys.SHIFT).doubleClick(username).contextClick(username).build();
       seriesofactions.perform();
    }
}


Reported by maheshknvr on 2015-02-25 09:51:56

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 17:45:55

  • Labels added: Restrict-AddIssueComment-Commit

@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant