Selenium web driver: cannot be scrolled into view

前端 未结 4 1157
天涯浪人
天涯浪人 2020-11-29 10:13

I am using Selenium IDE and Selenium web driver testng in eclipse .. my testing is against ZK application ..

the test case works fine on Selenium IDE ..



        
4条回答
  •  长情又很酷
    2020-11-29 10:59

    I'm not sure but try and see if following works for you. First, you've to make that element visible before interacting with it -

    WebElement element = driver.findElement(By.xpath("//div[2]/div[2]"));
    ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element);
    

    The above code will scroll down till the element is visible and then you can click on it.

提交回复
热议问题