- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试执行以下代码
public static void main(String[] args) throws MalformedURLException {
AndroidDriver<AndroidElement> driver=Capabilities();
//xPath id className, androidUIautomator //tagname[@attribute='value']
//Registration of the device
//driver.findElementByXPath("//android.widget.EditText[@resource-id='iMSSO_Alert1_Continue_button']").click();
//driver.findElementByXPath("//android.widget.EditText[@resource-id='btnAgree']").click();
driver.findElementByXPath("//android.widget.EditText[@resource-id='USER']").sendKeys("aris");
driver.findElementByXPath("//android.widget.EditText[@resource-id='PASSWORD']").sendKeys("kKL2WBU7ggCeMh4izUY4Kg==");
driver.findElementByXPath("//android.widget.EditText[@resource-id='btnLogin']").click();
}}
package appiumsample1;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class base1 {
public static AndroidDriver<AndroidElement> Capabilities() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My tab");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
return driver;
/*public static void main(String[] args) {
//Set the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My Phone");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
//Instantiate Appium Driver
try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
} */
// UI Automator tool
}
异常
remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'TFL0074ALKVTMLM', ip: '10.69.131.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:447:37) at process._tickCallback (internal/process/next_tick.js:68:7) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'TFL0074ALKVTMLM', ip: '10.69.131.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181' Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:323) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:86) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:96) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:94) at appiumsample1.base1.Capabilities(base1.java:25) at appiumsample1.base2.main(base2.java:13) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186) ... 15 more Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'TFL0074ALKVTMLM', ip: '10.69.131.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181' Driver info: driver.version: AndroidDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.verizon.launcher.sdnasit' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\SINGTO2\AppData\Local\android\sdk\platform-tools\adb.exe -P 5037 -s ce12182cabcaaa27017e shell am start -W -n com.verizon.launcher.sdnasit/com.verizon.launcher.webview.WebActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability at getResponseForW3CError (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:826:9) at asyncHandler (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:447:37) at process._tickCallback (internal/process/next_tick.js:68:7) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62) at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
根据答案添加代码
public class base1 {
public AndroidDriver<MobileElement> driver;
public WebDriverWait wait;
public Dimension size;
public String destDir;
public DateFormat dateFormat;
public (swipe) {
};
public (takeScreenShot) {
};
@BeforeMethod
public void setup () throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My tab");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("skipUnlock","true");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"),caps);
wait = new WebDriverWait(driver, 10);
}
@Test
public void test () throws Exception {
//Test commands
}
@AfterMethod
public void teardown(){
driver.quit();
}
/*public AndroidDriver<AndroidElement> Capabilities() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My tab");
caps.setCapability("udid", "ce12182cabcaaa27017e"); //Give Device ID of your mobile phone/name of the device
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.1.0");
caps.setCapability("skipUnlock","true");
caps.setCapability("appPackage", "com.verizon.launcher.sdnasit");
caps.setCapability("appActivity", "com.verizon.launcher.webview.WebActivity");
caps.setCapability("noReset", "true");
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
return driver;
wait = new WebDriverWait(driver, 10);*/
}
最佳答案
1- 首先检查appium是否正在运行。
2- 如果是,您应该知道有时 Node.js 无法与 127.0.0.1:4723 通信,因此请使用 0.0.0.0:4723 代替。请记住在代码 (DesiredCapability) 和 appium 设置中更改此设置。
3- 您应该保持如下所示的代码结构。还需要使用这 3 个符号:(@BeforeMethod , @Test, @AfterMethod)
类似这样的事情:
import <...>
.
.
public class sample { //this is the main class. You shouldn't define it as static or void so you must not have main methode
//define variables you will be use during the test
public AndroidDriver<MobileElement> driver;
public WebDriverWait wait;
public Dimension size;
public String destDir;
public DateFormat dateFormat;
.
.
.
//define the methodes you will be use during the test
public (swipe) {
... };
public (takeScreenShot) {
...};
@BeforeMethod
public void setup () throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "Galaxy S7 API 26");
caps.setCapability("udid", "ce0217124184c72505"); //DeviceId from "adb devices" command
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "8.0");
caps.setCapability("skipUnlock","true");
caps.setCapability("appPackage", "app_packageName"); // Your app packageName
caps.setCapability("appActivity","app_first_activity"); // The first activity of app. You can use "Apk Info2" application to find this
caps.setCapability("noReset","false");
driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"),caps);
wait = new WebDriverWait(driver, 10);
}
@Test
public void test () throws Exception {
//Test commands
}
@AfterMethod
public void teardown(){
driver.quit();
}
我希望这有帮助。
关于java - 执行Java程序appium出错及其他异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57777186/
我在识别“Appium”中突出显示的元素时收到以下消息。 Appium: 1.7.1设备:iPhone X(12.0 和模拟器)Java 客户端: 1.6.1Xcode:V 10 交互不适用于此元素。
我在 IOS 和 Android 的移动自动化中使用了 Appium。我想知道提供 Calabash 的优势,以及这两种工具生成的脚本是否有共同点? 我已经点击了这个链接:Appium VS Cala
由于 swipe() 已弃用,我无法从左向右滑动屏幕。我的应用程序中有 4 个横幅,我想滑动以查看所有横幅。 最佳答案 这适用于所有方向: 枚举: public enum DIRECTION {
在进行 Appium 测试时,我单击退出应用程序的按钮,如何检查应用程序是否正在运行或我们返回主屏幕。是否有任何方法可以仅通过包名称查找元素列表。 最佳答案 import io.appium.java
我试过命令: npm -install -g appium@1.6 但是当我重新启动 Appium 时,它仍然是 1.5.3 版本。 最佳答案 有两种不同类型的 appium 工具可用 Appium
Mac书空气 Java 1.8 Appium桌面版1.8.1 大家好, 我正在构建一个 TestNG 框架,并且我想以编程方式启动我的 appium 桌面服务器以进行测试。所以我决定做的是创建一个 j
打开终端 (cmd) 并运行 appium-doctor 后,我收到以下警告: WARN AppiumDoctor ✖ opencv4nodejs cannot be found. WARN Appi
这里是移动自动化的新手。我正在尝试使用 Touch Action 执行以下代码来执行滑动操作以导航到第 2 页,但滑动不起作用。 AndroidDriver driver=new AndroidDri
我有一个 iOS 应用程序,它在单个页面上有很多输入字段。我想自动执行这些输入,我知道如何滚动到这些元素和所有内容,但我对部分显示的元素有疑问。 有两种情况下部分显示的元素会导致问题: 第一种情况是当
我正在使用 eclipse 学习 appium,但在启动我的模拟器时卡住了。我尝试了不同的方法,例如在文件夹结构中四处移动文件,但我一直收到 文件不存在或不可访问 我尝试搜索答案,但没有任何帮助。 p
我的应用程序需要多个应用程序权限。我需要通过允许或拒绝不同的权限来检查我的应用程序的行为。如何从 appium 启用/禁用应用程序权限以创建多个场景? 例如,假设我的应用程序需要权限:permissi
我正在使用 Appium 版本 V1.15.0 并且已经使用默认主机:0.0.0.0 和端口:4723 成功启动服务器 但是现在当我尝试启动服务器时,它显示了这个错误“Error Starting A
我在一家提供 wifi 的公司工作。我有一些接入点设置,我想编写一些模拟连接到这些接入点的自动化测试。 所以我的测试将是这样的: 发射装置 转到设备上的 wifi 设置 选择要连接的wifi 验证设备
我在用 : Xcode 10.1 Os Version : 12.1 iPhone 6 我确实按照所有必需的步骤来设置构建和所有内容,但是在尝试使用 xcode build 构建项目时仍然出现错误。
我正在使用 appium 工具测试我的应用程序。在测试过程中,android应用程序在启动器事件附近崩溃,仅在8以下版本的某些设备上显示以下错误。如何解决? An unknown server-sid
我试图运行测试ipa。但是 appium 在循环中重新启动应用程序并产生此错误。 [INST STDERR] Instruments Trace Error : Target failed to ru
我想知道是否有人知道在运行 Appium 测试时使用什么 Java/Groovy 库/工具来嗅探、记录和处理 native 应用程序的 HTTP 流量?有没有人在特定情况下使用 Browser Mob
我在测试中担任 SD。我是 Appium 自动化工具的新手,这个工具对我来说设置环境非常棘手。 我引用了以下链接:http://unmesh.me/category/appium/ 这个链接帮助我安装
正在测试 Android 和 iOS 应用程序。这是我的应用程序的配置屏幕,出现一个 OTP 用例,停止对应用程序的进一步测试。用例是。 当用户在应用程序的起始页面输入手机号码时,指令为 。点击发送按
我已经安装了 appium doctor 并且在 mac 上没有错误地安装了它。但是,当我使用命令“appium-doctor -h”进行检查时。它给出了以下异常。你能告诉我这里出了什么问题吗: ap
我是一名优秀的程序员,十分优秀!