O
O
o_may2019-07-24 11:47:38
Java
o_may, 2019-07-24 11:47:38

How to scroll slick using selenium?

The site implements a horizontal gallery-type carousel via Slick https://kenwheeler.github.io/slick/
How can I scroll it to the element I need using selenium?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2019-07-24
@Phobos911

public static void main(String[] args) {
    WebDriver driver = null;
    ChromeOptions opt = new ChromeOptions();
    ChromeDriverManager.getInstance(DriverManagerType.CHROME).setup();
    opt.addArguments("--start-maximized");
    
    driver = new ChromeDriver(opt);
    driver.manage().window().setSize(new Dimension(1920, 1080));
    
    driver.get("https://kenwheeler.github.io/slick");
    WebElement el = driver.findElement(By.className("slick-arrow"));
    for (int i = 0; i <50; i++) {
      el.click();
      System.out.println("hello");try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question