Element not visible sometimes with Robot Framework
My approach is to change the 'Wait Until Element is Visible' to Wait Until Page Contains Element
like below..
${check_element}= Run Keyword and Return Status Wait Until Page Contains Element locator 10s
Run Keyword If '${check_element}' == 'True' Click Element locator
The reason to change to this keyword is that sometimes, the element is already loaded and available in DOM or page but the visibility is hidden. This intermittent weird thing happen to me some times.
user3033194
Updated on August 07, 2022Comments
-
user3033194 over 1 year
I am working with Robot FW for the first time and am facing an issue - one of the test cases requires a modal confirmation dialog to open, after which a button "Delete" is pressed. The keyword for the test case is given below:
Delete Test Data [Arguments] ${name} Wait Until Element Is Visible xpath=//tr[@item_name='${name}'] Click Button xpath=//tr[@item_name='${name}']//button[@class='btn btn-sm btn-danger'] Wait Until Element Is Visible id=deleteItem timeout=10 Click Button Delete Wait Until Element Is Not Visible xpath=//tr[@item_name='${name}']
The line
Wait Until Element Is Visible id=deleteItem timeout=10
is causing all the problems. Sometimes the element is visible within the time limit, at other times it is not. I increased the timeout to 10 seconds, but it does not fix the problem. How can I make the dialog appear each time without failing? Any help is appreciated, thanks!