Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a beginner in Selenium and m trying to automate the drag and drop functionality. But everytime I am trying to execute the dragAndDrop() functionality, Eclipse is Giving off Exception.

PF the code and the Exceptions below.


public class DragAndDropEvents 
    WebDriver driver=new FirefoxDriver();

    public void dragElement()
        WebElement draggable = driver.findElement("draggable")); 
        new Actions(driver).dragAndDropBy(draggable, 120, 120).build() .perform();

    public static void main(String[] args) 
    DragAndDropEvents dragDrop=new DragAndDropEvents();


    Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"draggable"}
Command duration or timeout: 34 milliseconds
For documentation on this error, please visit:
Build info: version: '2.38.0', revision: 'bd32d4e', time: '2013-12-05 16:16:40'
System info: host: 'MyLappy', ip: '', 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=28.0, platform=XP, browserConnectionEnabled=true, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 7dc1eb06-deb9-42e3-9994-2e7a3a41517f
    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 org.openqa.selenium.remote.ErrorHandler.createThrowable(
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(
    at org.openqa.selenium.remote.RemoteWebDriver.execute(
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(
    at org.openqa.selenium.remote.RemoteWebDriver.findElementById(
    at org.openqa.selenium.By$ById.findElement(
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(
    at DragAndDropEvents.dragElement(
    at DragAndDropEvents.main(
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"id","selector":"draggable"}
Build info: version: '2.38.0', revision: 'bd32d4e', time: '2013-12-05 16:16:40'
System info: host: 'MyLappy', ip: '', 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0'
Driver info: driver.version: unknown
    at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/Pratibha/AppData/Local/Temp/anonymous8582348192003844770webdriver-profile/extensions/
    at <anonymous class>.FirefoxDriver.prototype.findElement(file:///C:/Users/Pratibha/AppData/Local/Temp/anonymous8582348192003844770webdriver-profile/extensions/
    at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/Pratibha/AppData/Local/Temp/anonymous8582348192003844770webdriver-profile/extensions/
    at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/Pratibha/AppData/Local/Temp/anonymous8582348192003844770webdriver-profile/extensions/
    at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/Pratibha/AppData/Local/Temp/anonymous8582348192003844770webdriver-profile/extensions/

I tried the Above code using different types of locators like 01. xpath 02. className 03. Name etc. Always I am encountering the same exception. Only when tried with xpath, the Exception does not occur but it won't do the required function. It will select the the text at the bottom of the page.

Am at a fix!! Please help me with this issue. Thanks in Advance:)

share|improve this question
up vote 2 down vote accepted

Coincidentally I was working on the same url, trying my hands at handling the Jquery pop-up and kept getting the same error you are.

I was just messing around with the source code of the page and accidentally found the solution. In our haste to handle the pop-ups we missed a simple thing. The website uses an iframe.

Just add the following line right after the driver.get command and you'll be good to go:

share|improve this answer
Thanks a lot for the answer!! It Worked!! – Pratibha Apr 23 '14 at 15:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.