A simple Appium script that opens Safari on iOS or Chrome on Android and measures the performance of navigating to GitHub and searching for "github".
- ✅ Supports iOS Safari and Android Chrome
- ✅ Measures navigation time to GitHub
- ✅ Performs search and measures time to load results
- ✅ Provides detailed performance metrics
- ✅ Easy to configure and run
- Node.js (version 14 or higher)
- Appium Server installed globally
- iOS Requirements (for iOS testing):
- macOS with Xcode installed
- iOS Simulator or real iOS device
- XCUITest driver for Appium
- Android Requirements (for Android testing):
- Android SDK installed
- Android Emulator or real Android device
- Chrome browser installed on the device/emulator
- UiAutomator2 driver for Appium
- Clone this repository:
git clone https://github.com/JosephFanous/AppiumTesting.git
cd AppiumTesting- Install dependencies:
npm install- Install Appium globally (if not already installed):
npm install -g appium- Install Appium drivers:
For iOS:
appium driver install xcuitestFor Android:
appium driver install uiautomator2Before running the tests, you may need to adjust the capabilities in index.js to match your environment:
const iosCapabilities = {
platformName: 'iOS',
'appium:platformVersion': '17.0', // Change to your iOS version
'appium:deviceName': 'iPhone 15', // Change to your device name
'appium:browserName': 'Safari',
'appium:automationName': 'XCUITest',
};const androidCapabilities = {
platformName: 'Android',
'appium:platformVersion': '13.0', // Change to your Android version
'appium:deviceName': 'Android Emulator', // Change to your device name
'appium:browserName': 'Chrome',
'appium:automationName': 'UiAutomator2',
};First, start the Appium server in a separate terminal:
appiumThe server should start on http://localhost:4723
Run the test for iOS (default):
npm test
# or
npm run test:ios
# or
node index.js --platform=iosRun the test for Android:
npm run test:android
# or
node index.js --platform=android- Connects to the Appium server
- Opens Safari (iOS) or Chrome (Android)
- Navigates to https://github.com
- Measures the time it takes for the page to fully load
- Searches for "github" using the GitHub search
- Measures the time from initiating the search until the results page loads
- Reports detailed performance metrics
🚀 Starting Appium test for IOS
📱 Platform: iOS
🌐 Browser: Safari
⏳ Connecting to Appium server...
✅ Connected to Appium server
🔍 Navigating to GitHub...
⏳ Waiting for page to load...
✅ Page loaded successfully
⏱️ Navigation time: 3245ms (3.25s)
🔎 Searching for "github"...
⏳ Waiting for search results to load...
✅ Search results loaded successfully
⏱️ Search to page load time: 2156ms (2.16s)
📍 Current URL: https://github.com/search?q=github
⏱️ Total execution time: 5401ms (5.40s)
📊 Performance Summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Platform: iOS
Browser: Safari
Navigation Time: 3.25s
Search Time: 2.16s
Total Time: 5.40s
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧹 Cleaning up...
✅ Session closed
✅ Test completed successfully!
Make sure the Appium server is running on localhost:4723 before running the test.
- Verify the device name in
iosCapabilitiesmatches an available simulator - List available simulators:
xcrun simctl list devices
- Make sure an Android emulator is running or a device is connected
- Check connected devices:
adb devices
- Install Chrome browser on your Android emulator/device
- Or change the
browserNamecapability to another installed browser
- Increase timeout values in the script if your network is slow
- Check your internet connection
- Verify that the device/emulator can access the internet
ISC