appium
unknown
javascript
3 years ago
1.1 kB
9
Indexable
const wd = require('wd');
// Specify the Appium server settings
const serverConfig = {
host: 'localhost',
port: 4723
};
// Specify the desired capabilities for the Chrome browser
const chromeCaps = {
platformName: 'Android', // Add the platformName capability
browserName: 'Chrome'
};
async function runTest() {
// Create a new Appium driver with the specified server configuration and capabilities
const driver = await wd.promiseChainRemote(serverConfig);
try {
// Connect to the Appium server
await driver.init(chromeCaps);
// Navigate to Google.com
await driver.get('https://www.google.com');
// Wait for the page to load
await driver.waitForElementByCss('#hplogo', wd.asserters.isDisplayed, 10000);
// Get the page title and print it
const pageTitle = await driver.title();
console.log('Page title:', pageTitle);
} catch (err) {
console.error('An error occurred:', err);
} finally {
// Quit the Appium session
if (driver.sessionID) {
await driver.quit();
}
}
}
runTest();
Editor is loading...