Jump to content

Automating Drag and Drop in Java


xgmaker
 Share

Recommended Posts

Hi all, I'm new here and have recently started using AutoIt alongside selenium to perform automation testing on my web application. I'm currently stuck with a situation where I want to automate testing on a drag and drop element (the user can drag and drop a file from their desktop/folder into the web application). I know in selenium I can simply insert the file path into the web element, but in this scenario I want to be able to test the functionality of the drag and drop. 

I'm currently using the AutoItx4java bridge and programming in java. To sum things up, I need help creating a script that opens a folder and drags and drops the item at a given coordinate. These coordinates are determined in selenium so I can't simply use an exe script since I would need to enter the coordinates as parameters. I understand how to do this strictly from an AutoIt script, but am having difficulty doing it with an AutoItX object in java. I'm also unsure of how to open a folder in java. 

AutoItX x = new AutoItX();
x.run("explorer.exe ", "C:\\users" );

Any input or advice would be greatly appreciated. 

Edited by xgmaker
Link to comment
Share on other sites

  • 1 year later...

code

import java.io.File;

import com.jacob.com.LibraryLoader;

import autoitx4java.AutoItX;

public class OpenDrive {

    public static void main(String[] args) {
        File file = new File("lib", "jacob-1.18-x64.dll");
        System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
        AutoItX x = new AutoItX();
        x.run("explorer.exe C:\\Users","",AutoItX.SW_MAXIMIZE);
    
    
    }

}
 

Edited by arunapawar
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...