-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid-web.js
More file actions
36 lines (30 loc) · 1.13 KB
/
Copy pathandroid-web.js
File metadata and controls
36 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { captureScreenshot, createDriver, waitForElement, buildCommonPcloudyOptions } = require('./utils');
async function main() {
const capabilities = {
platformName: 'Android',
'appium:platformVersion': '13.0.0',
'appium:automationName': 'UiAutomator2',
browserName: 'Chrome',
'pcloudy:options': buildCommonPcloudyOptions('SAMSUNG_GalaxyA52_Android_13.0.0_fcafd', true)
};
const driver = await createDriver(capabilities);
try {
await driver.url('https://www.example.com');
await waitForElement(driver, 'body');
await captureScreenshot(driver, 'androidweb-example');
await driver.url('https://www.wikipedia.org');
await waitForElement(driver, 'input[name="search"]');
await captureScreenshot(driver, 'androidweb-wikipedia');
const searchBox = await driver.$('input[name="search"]');
await searchBox.setValue('Appium');
await searchBox.keys(['Enter']);
await waitForElement(driver, '#firstHeading');
await captureScreenshot(driver, 'androidweb-search');
} finally {
await driver.deleteSession();
}
}
main().catch((error) => {
console.error(error);
process.exit(1);
});