Open rimeak opened 3 months ago
you can find log here : https://gist.github.com/rimeak/8e7273e5520663942cdc3ee7aa7d8773
@rimeak if the element is not found on the first attempt, the test immediately fails without retrying
I don't see any failures in the logs.
The test begins by establishing a session through a POST request to the /session endpoint. Following this, it proceeds to navigate to a designated URL using a POST request to /session/b4b308f3-e53e-4ef6-b135-33f4cdb9410e/url, with the URL provided in the request body.
Upon reaching the specified URL, the test initiates the search for elements on the page by sending a POST request to /session/b4b308f3-e53e-4ef6-b135-33f4cdb9410e/elements, accompanied by the XPath query. Upon successful execution, the response typically contains the ID of the element in the "value" field : Got response with status 200: {"sessionId":"403e3d02-7387-455e-9284-54cb0f01af9c","value":[{"ELEMENT":"00000000-0000-0023-ffff-ffff00000012","element-6066-11e4-a52e-4f735466cecf":"00000000-0000-0023-ffff-ffff00000012"}]}
During the execution flow, the test successfully locates and interacts with the second element identified by the XPath query //android.widget.Button[@resource-id=\"com.android.chrome:id/negative_button\"], as the response contains the ID of the element.
However, when attempting to locate the third element using the XPath query //android.widget.Button[@resource-id=\"details-button\"], the response returns with an empty "value" field : Got response with status 200: {"sessionId":"403e3d02-7387-455e-9284-54cb0f01af9c","value":[]}. This implies that the element may not have been fully loaded on the page at the time of the request, preventing the test from clicking it. Consequently, the test fails, and a screenshot is captured.
I've ensured that the locators are correctly defined, and when utilizing the "wait until page contains element" keyword before each click action, the test successfully retries until the element is found. I anticipated that the plugin would exhibit similar retry behavior, persistently attempting to locate the element within the specified timeout of 300000 milliseconds and an interval between attempts of 60000 milliseconds. However, it appears that the plugin does not retry the element lookup as expected, the test fails on the first attempt if the element is not found within the timeout period.
see pic below for fail when executing test with element-wait plugin
@rimeak is it possible to give a sample project to reproduce this issue ?
Sure @saikrishna321, here is a sample project :
SampleProjetc.zip
here is what i got in my case :
I'm using the element-wait plugin with Robot Framework and Appium2 to automate mobile testing. I've created a configuration file .appiumrc.json with the following settings: { "server": { "plugin": { "element-wait": { "timeout": 2000000, "intervalBetweenAttempts": 200, "excludeEnabledCheck": ["click", "false"] } }, "use-plugins": ["element-wait"] } } When executing tests, the Appium server starts with the plugin, and the timeout and interval settings are correctly applied. However, when attempting to find an element using the AppiumDriver.findElements() method, if the element is not found on the first attempt, the test immediately fails without retrying.
I expected the plugin to retry finding the element based on the configured timeout and interval settings, similar to how the Wait Until Page Contains Element keyword works in Robot Framework. However, it seems that the plugin is not retrying the element search.
Steps to Reproduce:
Set up Appium server with the element-wait plugin configured as described above. Write a test case to find an element that may not be immediately available. Execute the test case and observe that the test fails without retrying the element search. Environment:
Operating System: Windows Appium Version: 2.5.1 Device Under Test: android emulator
Expected Behavior: I expect the element-wait plugin to retry finding the element according to the configured timeout and interval settings, allowing for more robust and reliable element detection during test execution.