简体   繁体   English

如何通过在硒上拖放来上传本地图像

[英]How to upload local image by drag and drop on selenium

I'm trying to upload local image on Selenium. 我正在尝试在Selenium上上传本地图像。 The website can accept file only drag and drop. 该网站只能接受文件拖放。

Selenium IDE works well. Selenium IDE运作良好。

在此处输入图片说明

but I can't upload image by elesemnt.sendKey(); 但我无法通过elesemnt.sendKey();上传图片elesemnt.sendKey();

driver.findElement(By.xpath("//input[@name='image1']")).clear();
driver.findElement(By.xpath("//input[@name='image1']")).sendKeys("/Users/trmt_8/Desktop/BUYMA/1.png");
driver.findElement(By.xpath("//input[@name='image2']")).clear();
driver.findElement(By.xpath("//input[@name='image2']")).sendKeys("/Users/trmt_8/Desktop/BUYMA/38565487.png");

How can I upload image? 如何上传图片?

When I used Google chrome and chorome_driver, I could upload image.( ^^ ) 当我使用Google chrome和chorome_driver时,可以上传图片。( ^^

You can download form here ---> ChromeDriver - WebDriver for Chrome 您可以在此处下载表格---> ChromeDriver-适用于Chrome的WebDriver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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