简体   繁体   English

如何使用webdriver \\ appium从移动应用程序下载图像?

[英]How to download images from mobile application using webdriver\appium?

How to download images from mobile application using webdriver\\appium? 如何使用webdriver \\ appium从移动应用程序下载图像? for example: whatsapp, amazon 例如:whatsapp,亚马逊

If the sole purpose of your task is to download some images that are coming in through a Native app like Amazon or Whatsapp, you don't need a high level framework like Appium or web driver. 如果您的任务的唯一目的是下载通过Amazon或Whatsapp之类的本机应用程序传入的某些图像,则您不需要诸如Appium或Web驱动程序之类的高级框架。 You can accomplish that task through network layer. 您可以通过网络层完成该任务。

To start with, While browsing through the images that you are interested in hook up Fiddler or Charles proxy , enable SSL proxying, install root cert etc. to see what are the HTTP requests that are giving the images. 首先,在浏览您感兴趣的图像时,请连接FiddlerCharles代理 ,启用SSL代理,安装root cert等,以查看给出图像的HTTP请求。

You can mimic the exact same thing using network requests in your favorite programming language. 您可以使用自己喜欢的编程语言使用网络请求来模仿完全相同的事物。

I suggest you look at HtmlUnit library. 我建议您看一下HtmlUnit库。

After you added the library, the code will looks like: 添加库后,代码将如下所示:

File fileToSaveImage = new File(dirToSave, normalizedName);
HtmlImage elementHtmlImage = (HtmlImage) pageWithImage.<HtmlImage>getFirstByXPath(X_PATH_FOR_IMAGE);
elementHtmlImage.saveAs(fileToSaveImage);

Of course you have to care about X_PATH_FOR_IMAGE , but I am sure it can be generalized by some site-specific pattern. 当然,您必须关心X_PATH_FOR_IMAGE ,但是我确信可以通过某些特定于站点的模式将其推广。

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

相关问题 使用appium自动化移动应用程序 - Automation mobile application using appium 如何使用 appium 自动化 flutter 移动应用程序? - How to automate flutter mobile app using appium? 如何使用selenium webdriver从第三个网站下载文件 - How to download file using selenium webdriver from a third website 我们如何使用 Appium 和 Java 获得加载移动应用程序页面的准确时间? - How can we get exact time to load a Mobile Application page using Appium and Java? 如何使用不同类型的用户打开同一移动应用程序以及如何使用appium在它们之间进行切换 - How to open same mobile application with different types of users and switching between them using appium 在使用 appium 的 Android 移动应用程序上,如何获取我们需要滚动的 web 元素列表? - On Android Mobile application using appium , how to fetch the list of web-Elements for which we need to scroll? 如何使用appium处理已安装的应用程序? - How to work with already installed application using appium? 如何使用appium测试聊天应用程序? - How to test a chatting application using appium? 如何使用 Webdriver 等待下载完成 - How to wait for download to finish using Webdriver 如何使用WebDriver关闭Firefox的下载对话框 - How to dismiss the download dialog of Firefox using WebDriver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM