Could not get a valid element rectangle from - AngularJS app
Posted: Wed Jan 04, 2017 11:15 am
Hi,
I have looked for and checked most of the topics here related to 'Could not get a valid element rectangle from' error and none helped me with my problem.
I have an angularJS web application. In this application there is a table which is being refreshed during time. I have repository item with XPath definition like this: row=.../table/tbody/tr[1]. So basically I want to click on the first row (I gave up on the option of getting row based on some value in som td tag ...). The row may have a CSS class defined, if this is the case, the row is already selected and I don't want to click on it. So I use code like this:
When I execute the test, it sometimes goes fine and sometimes (more often) I get the warning(2 lines, one for each line in the code with the item):
It has similar behaviour in Spy. When I track the row (or any of the <td> in the row), I have few seconds to see the attributes of the children of the row, but after that all information vanish. I have to refresh (update) the element. But whenever I click on Highlight the item from the repository, it works. So how can I achieve the same behaviour during the runtime? I need to refresh/update the element right before the call of click() method (and accessing the class attribute). Or is there another solution?
I have looked for and checked most of the topics here related to 'Could not get a valid element rectangle from' error and none helped me with my problem.
I have an angularJS web application. In this application there is a table which is being refreshed during time. I have repository item with XPath definition like this: row=.../table/tbody/tr[1]. So basically I want to click on the first row (I gave up on the option of getting row based on some value in som td tag ...). The row may have a CSS class defined, if this is the case, the row is already selected and I don't want to click on it. So I use code like this:
Code: Select all
public void Select_Row()
{
if (repo.MyApp.Body.Content.Table.Body.FirstRow.Class == null){
repo.MyApp.Body.Content.Table.Body.FirstRow.Click();
Report.Info("Mouse", "The first row was clicked");
}
else {
Report.Info("The first row was already selected");
}
}
The test then clicks in the top left corner, so the rest of the execution fails..10:11:21 Warn Automation Could not get a valid element rectangle from '{TrTag:}', since the element is no longer valid.
10:11:22 Warn Automation Could not get a valid element rectangle from '{TrTag:}', since the element is no longer valid.
It has similar behaviour in Spy. When I track the row (or any of the <td> in the row), I have few seconds to see the attributes of the children of the row, but after that all information vanish. I have to refresh (update) the element. But whenever I click on Highlight the item from the repository, it works. So how can I achieve the same behaviour during the runtime? I need to refresh/update the element right before the call of click() method (and accessing the class attribute). Or is there another solution?