selenium webdriver move slider on left side

后端 未结 7 575
旧巷少年郎
旧巷少年郎 2020-12-18 16:35

I want to move slider on left side of slider-bar. However, selenium webdriver moves it to right side but it does not move to left side. I want to move slider to 25% of total

7条回答
  •  囚心锁ツ
    2020-12-18 17:27

    The following code works for slide bars with two sliders:

        WebElement sliderA = driver.findElement(By.xpath("Left slider xpath"));
        Actions move = new Actions(driver);
        move.dragAndDropBy(sliderA,10, 0).click();
        move.build().perform();
    
    
        WebElement sliderB = driver.findElement(By.xpath("Right slider xpath"));
    
        move.dragAndDropBy(sliderB, -50, 0).click();
        move.build().perform();
    

提交回复
热议问题