Ranorex loses element
Posted: Wed Oct 23, 2019 12:31 pm
Hi,
I am automating in web environment and my goal is to remove a table row by clicking on the rows "Remove"-button (see attached pic). Buttons will become visible when you hover the mouse over a table row. In a different code module I move the mouse pointer on the desired table row, so the buttons become visible.
The purpose of this code module is to click on the "Remove"-button (trash can). As you see from the code, mouse pointer is first moved to the "Add"-button and then to "Remove"-button. But for some reason, when mouse pointer is moved to "Add"-button, Ranorex moves the mouse pointer then to the top-left corner of the window, which usually means that it cannot find something. Why?? Why does Ranorex lose the element?
Also if I add after btnAddNewRow.MoveTo(1000); a click action btnAddNewRow.Click();, it never get executed, because the mouse pointer is in top-left corner.
-Matts
I am automating in web environment and my goal is to remove a table row by clicking on the rows "Remove"-button (see attached pic). Buttons will become visible when you hover the mouse over a table row. In a different code module I move the mouse pointer on the desired table row, so the buttons become visible.
The purpose of this code module is to click on the "Remove"-button (trash can). As you see from the code, mouse pointer is first moved to the "Add"-button and then to "Remove"-button. But for some reason, when mouse pointer is moved to "Add"-button, Ranorex moves the mouse pointer then to the top-left corner of the window, which usually means that it cannot find something. Why?? Why does Ranorex lose the element?
Also if I add after btnAddNewRow.MoveTo(1000); a click action btnAddNewRow.Click();, it never get executed, because the mouse pointer is in top-left corner.
// Move mouse first to "Add new row"- button and then to "Remove"-button ButtonTag btnRemove, btnAddNewRow; if(repo.RAIsoftNet.PersonPlanning.tblCareNeeds.TryFindSingle("./tbody//button[1]", out btnAddNewRow)) { Report.Info("Info", "Add-button found"); btnAddNewRow.MoveTo(1000); if(repo.RAIsoftNet.PersonPlanning.tblCareNeeds.TryFindSingle("./tbody//button[2]", out btnRemove)) { Report.Info("Info", "Remove-button found"); btnRemove.MoveTo(1000); btnRemove.Click(); } else throw new ValidationException("Remove-button not found"); } else throw new ValidationException("Add new-button not found");BR
-Matts