Error in the class for moving Slider in Jquery | Selenium Forum
M
Posted on 22/12/2015
WebDriver driver = new FirefoxDriver();
//driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

driver.get("http://jqueryui.com/slider/");

List<WebElement> frames = driver.findElements(By.tagName("iframe"));
System.out.println("Total frames are "+frames.size());

driver.switchTo().frame(0);

WebElement obj = driver.findElement(By.xpath("html/body/div[1]/span"));
System.out.println(obj.isDisplayed());

Actions act = new Actions(driver);
int x= obj.getLocation().x;
act.clickAndHold(obj).dragAndDropBy(obj, x, 200).build().perform();

When I am trying to run this class .. I am getting below error

Exception in thread "main" org.openqa.selenium.WebDriverException: UnknownError: Cannot press more then one button or an already pressed button.'UnknownError: Cannot press more then one button or an already pressed button.' when calling method: [wdIMouse::down]
Command duration or timeout: 20.11 seconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 02:56:46'
System info: host: 'Bhanu-VAIO', ip: '192.168.2.13', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79'
Session ID: fd81a266-a4f2-4907-b3ce-22e7c4b8095d
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=42.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at

Can someone pls tell me, why am I getting this error.

M
Replied on 23/12/2015

act.clickAndHold(obj).moveByOffset(x+100, 200).build().perform();