简体   繁体   English

如何在C#中使用Selenium WebDriver下载图像

[英]How to download image using Selenium WebDriver in c#

Here's the workflow 这是工作流程

  1. goto a Url using FireFoxDriver - DONE 使用FireFoxDriver转到一个网址-完成
  2. Save a list of all images on this page - DONE 在此页上保存所有图像的列表-完成
  3. foreach image in this saved list use WebDriver.NavigateTo().GoUrl(imageUrl) - DONE 此保存列表中的foreach图像使用WebDriver.NavigateTo()。GoUrl(imageUrl)-完成

Question: How to Get / Save The Image Stream into a file on disk ? 问题:如何将图像流获取/保存到磁盘上的文件中?

我不确定我是否了解上下文,但是如果您真的只想将文件保存到磁盘,则不必使用Selenium,您可以使用WebClient.DownloadFile()方法。

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

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