Giter Club home page Giter Club logo

Comments (4)

timrsfo avatar timrsfo commented on July 29, 2024 1

@vikramv, thanks for the update. Did you see my solution as shown by the link above Drag and Drop in selenium java?

I took a look at your code, I see you are also using rcorreia/drag_and_drop_helper.js .
I also pushed my solution to my github se-drag-n-drop java

from elemental-selenium-tips.

sturman avatar sturman commented on July 29, 2024

Here are the reason and workaround why DnD does not work SeleniumHQ/selenium#1365
Workaround for Ruby is here http://elementalselenium.com/tips/39-drag-and-drop

from elemental-selenium-tips.

timrsfo avatar timrsfo commented on July 29, 2024

@RomanIsko Thanks for the input, I figured out a java implementation using the dnd.js and your C# code a few weeks back:

/**
 * Solution from elemental-selenium-tips
 * https://github.com/tourdedave/elemental-selenium-tips/blob/master/39-drag-and-drop/csharp/DragAndDrop.cs
 * JSDriver.ExecuteScript(dnd_javascript + "$('#column-a').simulateDragDrop({
 * dropTarget: '#column-b'});");
 * 
 * NOTE: Seems fragile, not sure if this works for XPATH or other src/dst type strings
 * TODO: would be good if it worked with WebElement, or BY
 * 
 * @param driver
 * @param src
 *            - css string for source element
 * @param dst
 *            - css string for destination element
 */
public void dragDrop(WebDriver driver, String src, String dst) {
    String js = String.format("$('%s').simulateDragDrop({ dropTarget: '%s'});",src,dst);
    JavascriptExecutor jse = (JavascriptExecutor) driver;
    jse.executeScript(dragndrop_js + js);
}

see: Drag and Drop in selenium java

from elemental-selenium-tips.

vikramvi avatar vikramvi commented on July 29, 2024

@timrsfo you can refer to Java solution vikramvi/Selenium-Java@a1354ca, this is needed for HTML5 drag and drop which can't be done with standard selenium api.

from elemental-selenium-tips.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.