Umesh Kumar
Umesh Kumar

Reputation: 1397

How to do drag and drop from file system to browser using Selenium Web driver

I am trying to automate a requirement, where I have to drag images(jpeg or png) form a file and drop it to browser. I am using Selenium Web Driver as automation tool with JAVA, I tried but selenium doesnt support anything outside browser.

I need help can anyone guide me how can I automate this.

Upvotes: 1

Views: 6661

Answers (3)

Abhishek_Mishra
Abhishek_Mishra

Reputation: 4621

You better use autoit for it.

Drag and Drop

Upvotes: 1

Falkenfighter
Falkenfighter

Reputation: 588

If your trying to drop your image into some sort of input you could try this. I used this to upload files with selenium.

WebElement inputField = driver.findElement(By.xpath("//*[@id='MyInputField']");

inputField.sendKeys("path to image");

Hope this helps.

Upvotes: 1

Konstantin Dinev
Konstantin Dinev

Reputation: 34895

You would not be able to do this using selenium. The selenium bindings have access to the browser instance (the WebDriver) but to nothing outside of it.

Upvotes: 3

Related Questions