[{"data":1,"prerenderedAt":19},["ShallowReactive",2],{"blog-post-en-boost-phoma-flow-speed-efficient-device-management":3},{"slug":4,"lang":5,"title":6,"summary":7,"date":8,"tags":9,"tag_slugs":14,"thumbnail_url":15,"translations":16,"body":17,"asset_base":18},"boost-phoma-flow-speed-efficient-device-management","en","Boost Phoma Flow Speed with Efficient Device Management","Learn how to speed up Phoma flows by optimizing device resources, using stable selectors, and reducing UI overhead for faster, more reliable automation.","2026-11-29",[10,11,12,13],"phoma","automation","performance","android",[10,11,12,13],"https://blog-api.phomaapp.com/api/blog/posts/boost-phoma-flow-speed-efficient-device-management/thumbnail.svg?lang=en",[5],"## Why Speed Matters in Phoma Automation\n\nWhen you run a Phoma flow on a Windows PC, the bottleneck is often the Android device itself rather than the PC. A slow flow can waste hours of QA time, cause flaky tests, and frustrate developers. By tightening the connection, selecting efficient UI elements, and trimming unnecessary steps, you can cut execution time by 30‑50 % while keeping the same reliability.\n\n## 1. Optimize Device Connection Settings\n\nA solid connection is the foundation of a fast flow. Follow these practical steps:\n\n- **Prefer USB over Wi‑Fi** when possible. USB provides a more stable link and eliminates wireless latency.\n- **Install the latest ADB drivers** from Google or the device manufacturer. Out‑of‑date drivers cause handshakes that add seconds to each command.\n- **Enable USB debugging** on the phone and keep the \"Stay awake\" option turned on while the flow runs.\n- **Close background apps** on the device. Open apps compete for CPU and RAM, slowing UI interactions.\n- **Use a high‑performance power plan** on the Windows PC (e.g., \"High performance\" in Power Options) to avoid CPU throttling.\n\nThese tweaks reduce connection overhead and keep the device responsive throughout the automation.\n\n## 2. Choose Stable, Low‑Overhead Selectors\n\nSelectors determine how Phoma finds an element. Poor choices increase lookup time and cause failures after UI updates.\n\n- **Use content‑based attributes** such as `contentDescription` or `resource-id` instead of numeric indexes.\n- **Avoid XPath expressions** that traverse deep node trees; they are slower than direct attribute matches.\n- **Leverage the accessibility tree** when available – it exposes stable IDs that survive layout changes.\n\n**Example selector (JSON):**\n```json\n{\n  \"type\": \"element\",\n  \"attributes\": {\n    \"resource-id\": \"com.example.app:id/login_button\",\n    \"enabled\": true\n  }\n}\n```\nThis selector points directly to the button by its resource ID, eliminating the need for visual matching.\n\n## 3. Reduce UI Interaction Frequency\n\nEvery tap, swipe, or screenshot adds latency. Minimize these actions by:\n\n- **Using wait‑for‑element steps** instead of fixed `sleep` commands. Wait until the target element exists or becomes clickable.\n- **Grouping actions**: perform a single swipe rather than multiple tiny swipes.\n- **Limiting screenshot captures** to critical points only; excessive screenshots consume CPU and storage.\n\n**Code snippet (pseudo‑step):**\n```\nWait for element with resource-id \"com.example.app:id/loading_spinner\" to disappear\nTap element with resource-id \"com.example.app:id/submit_button\"\n```\nThis replaces a 2‑second static wait with a dynamic check that proceeds as soon as the UI is ready.\n\n## 4. Manage Phone Resources\n\nEven with a fast connection, the device can become a bottleneck if its resources are stretched.\n\n- **Disable animations**: run `adb shell settings put system animator_duration_scale 0` on the device. This makes UI transitions instantaneous.\n- **Set the device to high‑performance mode** (often found in Developer Options).\n- **Restart the device** before a long test run to clear memory leaks.\n- **Use a dedicated test device** rather than a shared personal phone, to avoid interruptions from notifications.\n\nThese settings keep the UI thread free, allowing Phoma commands to execute swiftly.\n\n## 5. Batch Actions and Parallel Execution\n\nRunning the same action on many devices can be efficient, but each device consumes resources. Follow these guidelines:\n\n- **Batch size**: limit concurrent devices to 2‑3 for most machines; more devices increase CPU and network load.\n- **Use the \"Run on multiple devices\" feature** in Phoma, but monitor the total runtime; sometimes splitting a flow into separate flows per device is faster.\n- **Parallelize independent flows** (e.g., smoke tests for different modules) rather than nesting them in a single flow.\n\nBy balancing parallelism with resource caps, you achieve high throughput without slowing any single device.\n\n## 6. Use Efficient Waits and Conditions\n\nPhoma offers several wait mechanisms; choose the one that matches the UI behavior:\n\n- **Wait for element existence** – ensures the element is present before interacting.\n- **Wait for element visibility** – useful when elements are hidden behind scrollable containers.\n- **Conditional waits** – pause until a text value changes or a screen transition occurs.\n\nAvoid `sleep` commands; they waste time. Instead, combine a short timeout with a retry loop if the element may appear later.\n\n## 7. Real‑World Example: Fast Checkout Flow\n\nImagine automating a checkout sequence in an e‑commerce app. Below is a step‑by‑step flow with performance tips applied:\n\n1. **Connect via USB** and verify the device is recognized.\n2. **Wait for the home screen** using `Wait for element with resource-id \"com.shop.app:id/main_menu\"` (instead of a 3‑second sleep).\n3. **Tap the product list** – use a stable selector `resource-id=\"com.shop.app:id/product_grid\"`.\n4. **Scroll to the desired item** – a single swipe command rather than multiple tiny swipes.\n5. **Tap the product** – selector based on `content-description=\"Red T‑Shirt\"`.\n6. **Add to cart** – wait for the \"Added\" toast to disappear before proceeding.\n7. **Proceed to checkout** – use a conditional wait for the \"Proceed\" button to become enabled.\n8. **Enter shipping details** – type text only after confirming the input field is focused, avoiding unnecessary taps.\n9. **Submit order** – wait for the confirmation screen, then capture a screenshot for verification.\n\nBy replacing fixed delays with precise waits and using stable selectors, the entire flow runs in ~45 seconds on a mid‑range device, compared to 1 minute 30 seconds with naïve scripting.\n\n## 8. Measuring Impact\n\nTrack the performance improvement to justify the optimizations:\n\n- **Enable Phoma logging** (`Settings → Log level → Debug`). Review the \"Duration\" column for each step.\n- **Use Windows Performance Monitor** to watch CPU usage of `adb.exe` during execution.\n- **Compare runtimes** before and after each optimization step; document the percentage reduction.\n\nA simple spreadsheet with columns \"Flow\", \"Original Time\", \"Optimized Time\", \"% Reduction\" gives a clear visual.\n\n## 9. Checklist for Faster Flows\n\n- ☐ Use USB debugging and a high‑performance PC power plan.\n- ☐ Install latest ADB drivers and keep them updated.\n- ☐ Close unrelated apps on the Android device before running a flow.\n- ☐ Prefer content‑based selectors over indexes or XPath.\n- ☐ Apply `animator_duration_scale 0` to disable UI animations.\n- ☐ Replace `sleep` with wait‑for‑element or conditional waits.\n- ☐ Limit screenshot captures to essential checkpoints.\n- ☐ Batch devices no more than 2‑3 per run unless resources allow.\n- ☐ Verify each step’s duration in Phoma logs and adjust accordingly.\n\nFollowing this checklist will consistently deliver quicker, more reliable Phoma automations, saving your team valuable time and reducing test flakiness.\n","https://blog-api.phomaapp.com/api/blog/posts/boost-phoma-flow-speed-efficient-device-management/assets",1796035638820]