简体   繁体   中英

AutoIT Drag and Drop in Java

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 send 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 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 why the following code does not open the folder in the specified directory.

AutoItX x = new AutoItX();
String path = "C:"+File.separator+"Users";
x.run("explorer.exe", path);

What am I doing incorrectly or is there a different method for automating this that I should look at? Any advice would help and thanks for your time.

Just a quick google and I found this

Credit to the owner

You just need to compiled it into exe then execute exe file using JAVA code.

Runtime.getRuntime ().exec ("/folder/exec.exe");

Of course, you may need some thread.sleep for the file finished executing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM