### Install and Configure Appium Wait Plugin Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Commands to install the Appium Wait Plugin via the Appium CLI and start the Appium server with the plugin enabled, including options for custom timeout and interval settings. ```bash appium plugin install --source=npm appium-wait-plugin appium --use-plugins=element-wait appium --use-plugins=element-wait \ --plugin-element-wait-timeout=30000 \ --plugin-element-wait-interval-between-attempts=200 \ --plugin-element-wait-exclude-enabled-check="click,clear" ``` -------------------------------- ### Install Appium Wait Plugin Source: https://github.com/appiumtestdistribution/appium-wait-plugin/blob/main/README.md Command to install the appium-wait-plugin using the Appium plugin CLI from NPM. ```bash appium plugin install --source=npm appium-wait-plugin ``` -------------------------------- ### Configure Wait Plugin via CLI Source: https://github.com/appiumtestdistribution/appium-wait-plugin/blob/main/README.md Example commands to configure the wait plugin's timeout and interval directly from the Appium server CLI. ```bash --plugin-element-wait-timeout=30000 --plugin-element-wait-interval-between-attempts=200 --plugin-element-wait-exclude-enabled-check="click,clear" ``` -------------------------------- ### Activate Appium Wait Plugin Source: https://github.com/appiumtestdistribution/appium-wait-plugin/blob/main/README.md Command to activate the appium-wait-plugin when starting the Appium server. ```bash appium --use-plugins=element-wait ``` -------------------------------- ### Basic Element Finding with Automatic Waiting (JavaScript) Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Demonstrates how the plugin automatically waits for elements to be present and displayed before interaction. It supports all standard locator strategies and simplifies test code by removing the need for explicit waits. This example uses WebDriverIO to connect to Appium. ```javascript const { remote } = require('webdriverio'); const driver = await remote({ hostname: 'localhost', port: 4723, path: '/wd/hub', capabilities: { platformName: 'iOS', 'appium:automationName': 'XCUITest', 'appium:deviceName': 'iPhone 14', 'appium:app': '/path/to/app.app' } }); // After wait-plugin: Automatic waiting // Plugin waits up to configured timeout (default 10s) for element to be present and displayed await driver.$('~login').click(); await driver.$('~username').setValue('john.doe@example.com'); await driver.$('~password').setValue('securePassword123'); await driver.$('~submitButton').click(); // Works with all locator strategies await driver.$('id=welcomeMessage').getText(); await driver.$('//XCUIElementTypeButton[@name="Continue"]').click(); await driver.$('.submit-button').click(); await driver.deleteSession(); ``` -------------------------------- ### Configure Appium Wait Plugin via Server Config File Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Example JSON configuration for the Appium Wait Plugin within the Appium server configuration file, specifying timeout and interval between attempts. ```json { "server": { "port": 4723, "plugin": { "element-wait": { "timeout": 20000, "intervalBetweenAttempts": 200 } } } } ``` -------------------------------- ### Skip Element Enabled Check in WDIO Source: https://github.com/appiumtestdistribution/appium-wait-plugin/blob/main/README.md WDIO example to configure the wait plugin to exclude element enabled checks for specific commands like 'click' and 'setValue'. ```javascript await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 1111, intervalBetweenAttempts: 11, excludeEnabledCheck: ['click','setValue'] }, ]); await driver.executeScript('plugin: getWaitPluginProperties', []) ``` -------------------------------- ### Configure Wait Plugin in Java Source: https://github.com/appiumtestdistribution/appium-wait-plugin/blob/main/README.md Java code snippet for configuring wait plugin properties (timeout, intervalBetweenAttempts) using executeScript. ```java driver.executeScript("plugin: setWaitPluginProperties", ImmutableMap.of("timeout", 1111 , "intervalBetweenAttempts", 11 )); ``` -------------------------------- ### Configure Wait Plugin in WDIO Source: https://github.com/appiumtestdistribution/appium-wait-plugin/blob/main/README.md JavaScript code snippet for configuring wait plugin properties (timeout, intervalBetweenAttempts) in WebdriverIO. ```javascript await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 1111, intervalBetweenAttempts: 11, }, ]); await driver.executeScript('plugin: getWaitPluginProperties', []) ``` ```javascript await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 1111, }, ]); await driver.executeScript('plugin: getWaitPluginProperties', []) ``` -------------------------------- ### Error Handling and Timeouts (JavaScript) Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Illustrates how the plugin handles errors when elements are not found or displayed within the configured timeout. It demonstrates catching `NoSuchElementError` and `ElementNotVisibleError` using try-catch blocks. The timeout and interval can be adjusted dynamically. ```javascript const { remote } = require('webdriverio'); const driver = await remote({ hostname: 'localhost', port: 4723, path: '/wd/hub', capabilities: { platformName: 'Android', 'appium:automationName': 'UiAutomator2', 'appium:deviceName': 'emulator-5554', 'appium:app': '/path/to/app.apk' } }); // Set short timeout for demonstration await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 3000, intervalBetweenAttempts: 500 } ]); try { // If element doesn't exist, plugin retries for 3 seconds then throws NoSuchElementError await driver.$('~nonExistentElement').click(); } catch (error) { console.error('NoSuchElementError: Time out after waiting for element nonExistentElement for 3000 ms'); } try { // If element exists but not displayed, plugin throws ElementNotVisibleError await driver.$('~hiddenElement').click(); } catch (error) { console.error('ElementNotVisibleError: Element was not displayed! Please make sure the element is in viewport to perform the action'); } try { // If element cannot be enabled in time for click/setValue/clear await driver.$('~disabledButton').click(); } catch (error) { console.error('Error: Time out after waiting for element to be enabled for 3000'); } // Increase timeout for slower loading screens await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 30000 } ]); await driver.$('~slowLoadingElement').click(); // Now waits up to 30 seconds await driver.deleteSession(); ``` -------------------------------- ### Default Configuration Values (JavaScript) Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Lists the default configuration values for the Appium Wait Plugin when it is initialized. These include the default timeout, the interval between attempts to find an element, and the exclusion list for the enabled check. These defaults can be overridden. ```javascript // Default timeout properties when plugin is initialized const defaultTimeouts = { timeout: 10000, // 10 seconds max wait time intervalBetweenAttempts: 500, // Retry every 500ms excludeEnabledCheck: [] // Check enabled status for all commands }; // These can be overridden at server startup via CLI or config file // Or dynamically during test execution via setWaitPluginProperties ``` -------------------------------- ### Excluding Enabled Check for Specific Commands (JavaScript) Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Shows how to configure the plugin to skip the enabled check for specific commands like 'click', 'setValue', and 'clear'. This is useful for custom controls or elements that might appear disabled but are still interactive. The configuration is done dynamically using `executeScript`. ```javascript const { remote } = require('webdriverio'); const driver = await remote({ hostname: 'localhost', port: 4723, path: '/wd/hub', capabilities: { platformName: 'Android', 'appium:automationName': 'UiAutomator2', 'appium:deviceName': 'emulator-5554', 'appium:app': '/path/to/app.apk' } }); // Configure plugin to skip enabled check for specific commands await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 10000, intervalBetweenAttempts: 100, excludeEnabledCheck: ['click', 'setValue', 'clear'] } ]); // Now these commands will execute even if element appears disabled await driver.$('~customSlider').click(); // Executes without enabled check await driver.$('~specialInput').setValue('text'); // No enabled validation await driver.$('~customField').clear(); // Skips enabled verification // Get confirmation of settings const config = await driver.executeScript('plugin: getWaitPluginProperties', []); console.log(config.excludeEnabledCheck); // ['click', 'setValue', 'clear'] await driver.deleteSession(); ``` -------------------------------- ### Set Wait Plugin Properties at Runtime (Java) Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt Java code using AppiumDriver's executeScript method with ImmutableMap to dynamically configure Appium Wait Plugin properties like timeout, retry interval, and excluded enabled checks. ```java import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; import org.openqa.selenium.remote.DesiredCapabilities; import com.google.common.collect.ImmutableMap; // Initialize driver DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("platformName", "Android"); caps.setCapability("appium:automationName", "UiAutomator2"); caps.setCapability("appium:deviceName", "emulator-5554"); caps.setCapability("appium:app", "/path/to/app.apk"); AppiumDriver driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), caps); // Set wait properties with all parameters driver.executeScript("plugin: setWaitPluginProperties", ImmutableMap.of( "timeout", 15000, "intervalBetweenAttempts", 200, "excludeEnabledCheck", Arrays.asList("click", "clear") ) ); // Set only timeout driver.executeScript("plugin: setWaitPluginProperties", ImmutableMap.of("timeout", 10000) ); // Get current properties Map properties = (Map) driver.executeScript( "plugin: getWaitPluginProperties", Collections.emptyList() ); System.out.println(properties); // Element operations now automatically wait driver.findElement(AppiumBy.accessibilityId("loginButton")).click(); driver.findElement(AppiumBy.accessibilityId("username")).sendKeys("testuser"); ``` -------------------------------- ### Set Wait Plugin Properties at Runtime (JavaScript - WebdriverIO) Source: https://context7.com/appiumtestdistribution/appium-wait-plugin/llms.txt JavaScript code using WebdriverIO to dynamically configure Appium Wait Plugin properties such as timeout, retry interval, and excluded enabled checks at runtime via executeScript. ```javascript const { remote } = require('webdriverio'); // Create WebdriverIO session const driver = await remote({ hostname: 'localhost', port: 4723, path: '/wd/hub', capabilities: { platformName: 'Android', 'appium:automationName': 'UiAutomator2', 'appium:deviceName': 'emulator-5554', 'appium:app': '/path/to/app.apk' } }); // Set all wait properties await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 15000, intervalBetweenAttempts: 200, excludeEnabledCheck: ['click', 'setValue'] } ]); // Get current wait properties const properties = await driver.executeScript('plugin: getWaitPluginProperties', []); console.log(properties); // Output: { timeout: 15000, intervalBetweenAttempts: 200, excludeEnabledCheck: ['click', 'setValue'] } // Override only timeout await driver.executeScript('plugin: setWaitPluginProperties', [ { timeout: 5000 } ]); // Override only interval await driver.executeScript('plugin: setWaitPluginProperties', [ { intervalBetweenAttempts: 100 } ]); // Now perform element actions - plugin handles waiting automatically await driver.$('~loginButton').click(); await driver.$('~username').setValue('testuser'); await driver.$('~password').setValue('password123'); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.