Skip to content

((Locatable) element).getCoordinates().inViewPort() doesn't scroll to element in selenium-java #1527

Closed
@QALady

Description

@QALady

((Locatable) element).getCoordinates().inViewPort() doesn't scroll to element.

Steps to reproduce:

  1. Deploy the SmartGwtTester-1.0.war to e.g. Tomcat (pls see comment about attachment below)
  2. Execute the following test:
public class ScrollingIssue {

    private static Logger LOG = LoggerFactory.getLogger(ScrollingIssue.class);
    private static Logger BROWSER_LOG = LoggerFactory.getLogger("Browser");

    WebDriver driver = new FirefoxDriver();
    WebDriverWait wait = new WebDriverWait(driver, 5);

    @Test
    public void simpleTest() {
        //open  URL
        driver.get("http://localhost:8888/SmartGwtTester-1.0/");
        driver.manage().window().maximize();
        List<WebElement> results = driver.findElements(By.xpath("//td[@class='treeCell']//tbody/tr"));
        int items = results.size();
        System.out.println("total number of items is " + items);
        int i = 0;
        for (WebElement result : results) {
            ((Locatable) result).getCoordinates().inViewPort();
            WebElement itemLabel = result.findElement(By.xpath("./td[3][@class='treeCell'][contains(@style, 'white-space:nowrap')]"));
            String itemLabelText = itemLabel.getText();
            System.out.println("Click on #" + (i + 1) + " " + itemLabelText);
            WebElement checkbox = result.findElement(By.xpath("./td[2][@class='treeCell']/span[2]"));
            checkbox.click();
            i++;
        }
    }
}

Actual Result: The inViewPort() is not scrolling to 15th element in to view so the test is failing starting this point. All elements before #15 were already in View by default.

The issue is reproducible starting from Selenium 2.35 till Selenium 2.49.1 inclusive. The last working version is 2.34.

I have the war file to reproduce this issue unfortunately the file size is more than 10MB allowed. Please let me know where I can upload it.
Update: The file can be downloaded from here: http://turbobit.net/ih19hhutyehx.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions