Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Why drag and drop is not working in Selenium Webdriver?

    Why drag and drop is not working in Selenium Webdriver?

    July 10, 2024

    I am trying to drag an element into another element using Selenium WebDriver but it’s not working. I tried all the solutions which I can find on internet but none of the solutions seems to be working for me.

    WebElement sourceelement = driver.findElement(By.cssSelector(“XXX”));
    WebElement destelement = driver.findElement(By.cssSelector(“YYY”));

    Code1:-

    Actions builder = new Actions( _controls.getDriver());
    builder.dragAndDrop(sourceelement, destelement);

    Code2:-

    Actions builder = new Actions(_controls.getDriver());
    Action dragAndDrop =
    builder.clickAndHold(sourceelement).moveToElement(destelement).release(destelement).build();
    Thread.sleep(2000);
    dragAndDrop.perform()

    Code3:-

    Point coordinates1 = sourceelement.getLocation();
    Point coordinates2 = destelement.getLocation();
    Robot robot = new Robot();
    robot.mouseMove(coordinates1.getX(), coordinates1.getY());
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseMove(coordinates2.getX(), coordinates2.getY());
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    Thread.sleep(2000);

    Code4:-

    final String java_script =
    “var src=arguments[0],tgt=arguments[1];var dataTransfer={dropEffe” +
    “ct:”,effectAllowed:’all’,files:[],items:{},types:[],setData:fun” +
    “ction(format,data){this.items[format]=data;this.types.append(for” +
    “mat);},getData:function(format){return this.items[format];},clea” +
    “rData:function(format){}};var emit=function(event,target){var ev” +
    “t=document.createEvent(‘Event’);evt.initEvent(event,true,false);” +
    “evt.dataTransfer=dataTransfer;target.dispatchEvent(evt);};emit(‘” +
    “dragstart’,src);emit(‘dragenter’,tgt);emit(‘dragover’,tgt);emit(” +
    “‘drop’,tgt);emit(‘dragend’,src);”;

    ((JavascriptExecutor)_controls.getDriver()).executeScript(java_script, sourceelement, destelement);
    Thread.sleep(2000);

    None of the above code is working for me. All the above runs without any error but drag and drop is not happening in the application. Anyone having any other solution ? Thanks.

    Browser :- IE

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleIncrease the test performance avoiding the use of mock.create_autospec()
    Next Article Future-Proofing the Past: AI’s Role in Protecting Cultural Legacies

    Related Posts

    Machine Learning

    Salesforce AI Releases BLIP3-o: A Fully Open-Source Unified Multimodal Model Built with CLIP Embeddings and Flow Matching for Image Understanding and Generation

    May 16, 2025
    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    MSIL/Agent.PYO: Have botnet, will travel

    Development

    If you’re a Genshin Impact fan, these exclusive Ugreen charging accessories are a must

    Operating Systems

    RelCon: Relative Contrastive Learning for a Motion Foundation Model for Wearable Data

    Machine Learning

    Enhancing Your Wellness Journey: Optimizing Self-Care with Linux Gadgets

    Development

    Highlights

    Artificial Intelligence

    Legend Srinidhi Ranganathan’s The Bus

    May 10, 2024

    AudioDreamz EcoSystem: The Future Awaits For You Inside! Your gateway to speak to imaginary characters,…

    CVE-2025-3637 – Moodle CSRF Information Disclosure

    April 25, 2025

    My favorite headphones for deep work and gaming get a travel-friendly upgrade

    January 6, 2025

    Evolve Bank Confirms Data Breach, Customer Information Exposed

    June 27, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.