我使用Appium,NodeJS
我想在输入框输入文本后点击移动键盘上的搜索按钮。但是下面的代码都没有被执行。 会不会和依赖有关系?喜欢司机?或者使用的库(webdriverio)?
有人有完整的指南吗?
const { remote } = require("webdriverio");
const capabilities = {
"appium:platform": "Android",
"appium:platformVersion": "11",
"appium:automationName": "UiAutomator2",
"appium:appPackage": "com.android.settings",
"appium:appActivity": ".Settings",
platformName: "Android",
"appium:app":
"/Users/ASUS/Downloads/MEmu Download/Showcaller-Caller-ID-Block-1.9.1(www.Farsroid.com).apk",
"appium:deviceName": "Pixel 2 API 30",
"appium:adv": "Pixel_2_API_30",
"appium:autoGeneratePermissions": true,
"appium:settings[ignoreUnimportantViews]": true,
};
const wdOpts = {
hostname: process.env.APPIUM_HOST || "localhost",
port: parseInt(process.env.APPIUM_PORT, 10) || 4723,
logLevel: "info",
capabilities,
};
async function runTest() {
const driver = await remote(wdOpts);
try {
await driver.touchPerform([{ action: "tap", options: { x: 50, y: 50 } }]);
await driver.touchAction({
action: "tap",
x: 50,
y: 50,
});
} finally {
await driver.pause(1000);
await driver.deleteSession();
}
}
runTest().catch(console.log);
我找到了这个问题的答案
await driver.execute("mobile: performEditorAction", { action: "Search" });