Jump to content
xgmaker

Automating Drag and Drop in Java

Recommended Posts

xgmaker

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
  • Like 1

Share this post


Link to post
Share on other sites
RaiNote

I think wrong section cause you are using AutoItX(Link2Support)

Also Normal User path is C:\Users


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
arunapawar

It work

x.run("explorer.exe C:\\Users","",AutoItX.SW_MAXIMIZE);

Edited by arunapawar

Share this post


Link to post
Share on other sites
arunapawar

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

Share this post


Link to post
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

×