简体   繁体   English

如何使用Appium处理iOS更新警报

[英]How to handle iOS update alert with Appium

I am using Selenium with Appium and my tests run on Android and iOS real device. 我将Selenium与Appium一起使用,并且我的测试在Android和iOS真实设备上运行。 A set of tests run on android while iOS is idle. iOS闲置时,一组测试在android上运行。 Then the test switch to iOS. 然后测试切换到iOS。 Both devices are connected at the same time. 两个设备同时连接。

Below is the sequence of the suites I'm running using testNG : 以下是我使用testNG运行的套件的顺序:

<suite-file path="android_Suite1.xml" />
<suite-file path="ios_Suite1.xml" />
<suite-file path="android_Suite2.xml" />
<suite-file path="ios_Suite2.xml" />
<suite-file path="android_Suite3.xml" />
<suite-file path="ios_Suite3.xml" />

The problem here is iOS device shows os update installation pop-up when the test switch to android. 问题是当测试切换到android时,iOS设备显示os update安装弹出窗口。 I want to disable the pop-up before the test switch back to iOS. 我想在测试切换回iOS之前禁用弹出窗口。 I can delete the update from settings>storage. 我可以从“设置”>“存储”中删除更新。 But the tests run overnight and there is a possibility of the update being downloaded again. 但是测试会在一夜之间运行,并且有可能再次下载更新。 Since this is a system alert, the test wont start because no session is created as appium do not find the homescreen. 由于这是系统警报,因此不会启动测试,因为未创建任何会话,因为appium找不到主屏幕。 So the capabilities also wont work. 因此,这些功能也不起作用。 Need help to handle this specific pop-up. 需要帮助来处理此特定弹出窗口。

Not sure I can give you an exact solution but you could make a two threaded system, one for Android and one for iOS. 不知道我能给您一个确切的解决方案,但您可以制作两个线程的系统,一个用于Android,一个用于iOS。 Then just yield each thread while the other is testing. 然后,在其他线程正在测试时,只产生每个线程。 You will need to be running two instances of Appium to do this (different ports). 为此,您将需要运行两个Appium实例(不同的端口)。

Then depending on the exact functionality solve with one of the ways below: 然后根据确切的功能,使用以下方法之一解决:

1) Then also have a driver for each running. 1)然后每次运行都有一个驱动程序。 At that point you could just put into your logic on the iOS side to always dismiss/accept alerts. 那时,您可以在iOS方面投入逻辑,以始终关闭/接受警报。

2) You could have a thread stem off of the iOS thread that checks for the software popup ever 'x' seconds, then if found dismiss it. 2)您可能从iOS线程中提取了一个线程来检查软件弹出窗口“ x”秒,如果发现,则将其关闭。

I had a similar issue with asynchronous popups on android which I used option (2) to solve. 我在Android上使用选项(2)解决的异步弹出窗口也遇到了类似的问题。 Your issue seems to be a little bit more problematic than what I had to deal with. 您的问题似乎比我必须解决的问题多一些。 Hopefully this can get you started with a good solution though! 希望这可以使您从一个好的解决方案入手! Sorry for the ambiguous answer. 抱歉,答案不明确。

First you need to delete the downloaded update if it is downloaded already then you have to turn off the auto updates as below. 首先,如果已经下载了更新,则需要将其删除,然后按如下所示关闭自动更新。

Automatic Updates are enabled by default, so you'll need to turn them off. 默认情况下,自动更新处于启用状态,因此您需要将其关闭。 This won't help with the current update, but it will stop you from getting these messages in future. 这对当前更新无济于事,但它将使您以后无法获取这些消息。 So the first thing you should do is dive into settings and turn Automatic Updates off: 因此,您应该做的第一件事就是深入设置并关闭“自动更新”:

  1. Tap Settings. 点击设置。
  2. Tap iTunes & App Stores. 点击iTunes和App Store。
  3. Set Updates under "Automatic Downloads" to Off. 将“自动下载”下的更新设置为关闭。

This will prevent iOS from downloading updates in future, although you'll still need to deal with the update you've downloaded. 尽管您仍需要处理已下载的更新,但这将阻止iOS将来下载更新。

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

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