【发布时间】:2020-02-11 14:28:16
【问题描述】:
我正在使用 selenium + TestNG + Appium 在我的 MAC OS(eclipse IDE)中的模拟器设备上使用移动关键字框架模型执行自动化,
通过 .pom 文件使用以下版本:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.3.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.14.0</version>
</dependency>
大部分动作功能都很好,但我有一个关键字,每次在不同的 TestData(电子商务移动应用上的产品 ID)上重复执行 9 次动作大约需要 115 秒
关键字执行以下操作: 1.清除搜索产品文本字段。 2.在搜索框输入productID。 3. 从列表中选择找到的产品。 4.当产品详细信息页面出现时,复制(到ArrayList)产品详细信息并打印到日志+报告。 5. 点击+将该产品加入购物车
这意味着对一个关键字进行 5 次操作 所以我想每次操作都需要太多时间 问题是
对于 6-7 个产品,它运行良好,但下一个产品会导致此异常:
org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started site:stackoverflow.com
问题是当我长时间没有操作 MAC PC 时,我在哪里更改了等待时间 - 还将 MAC 系统偏好设置节能器更改为插入电源线时从不休眠 为了使模拟器不会长时间终止TestCase?
提前感谢任何为我解决此问题的人 :-)
【问题讨论】:
标签: java selenium appium appium-android