我正在尝试定位滑块并将其移动到与默认值不同的值。但是,Web驱动程序无法找到元素或无法执行操作。请帮忙。 enter image description here
答案 0 :(得分:0)
WebElement priceSlider = findMyElement(d,locator,locatorvalue); // int val = 100 / Integer.parseInt(locatorvalue);
int abc=100/Integer.parseInt(testdata);
Dimension sliderSize = priceSlider.getSize();
double sliderWidth = sliderSize.getWidth();
System.out.println("Slider width : " + sliderWidth);
double ab=(sliderWidth)/abc;
float f = Math.round(ab);
System.out.println("Float f : " + f);
int valu = Math.round(f);
System.out.println("Value of valu " + valu);
Actions move = new Actions(d);
move.moveToElement(priceSlider, valu, 0).click();
move.build().perform();
System.out.println("Slider moved");