我正在尝试使用Selenium + PhantomJS将图像上传到网站,但它失败了。
我试过了(我已经在页面上):
IWebDriver driver = new PhantomJSDriver();
var add_img = driver.FindElement(By.Id("image_upload_button"));
var image = add_img.FindElement(By.Name("file"));
Console.WriteLine("IMG: " + imagem.GetAttribute("type")); //Output: file
String convert = "C:\\Users\\Usuario\\Desktop\\myimage.jpg"; //Path
image.SendKeys(convert);
按钮上的HTML以上传图片:
<input type="file" multiple="multiple" accept="image/*" name="file" style="height: 72px; position: absolute; right: 0px; top: 0px; font-family: Arial; font-size: 118px; margin: 0px; padding: 0px; cursor: pointer; opacity: 0;"/>
我该怎么做?
错误:超载60秒..
我该怎么做?