Handle new dynamic table creation in a div in robot framework

Viewed 115

I am currently doing web UI automation using Robot Framework. For my current task I have a div tag which shows a table inside. The table only shows 25 elements at load time. See image of elements for reference. Initial Structure On Load

After scrolling the top div tag slowly, it creates new set of tables. See below image: After scrolling

The point is it doesn't show all tables at one go. Also it keeps on adding tables with _startrow attribute to a random value. It also deletes tables from earlier rows on scrolling.

I am not sure how to deal with such dynamic content. Using Execute Javascript keyword has not helped as well.

Any new help would be appreciated. Thank you.

1 Answers

Your situation is a bit specific (on the js framework, and the html it produces), but I'll take a stab of providing a bit generic answer - with pseudo code you'll need to adapt.

What does a user do to make sure the new data is loaded? They see an entry, scroll a bit, wait for that entry to disappear, and for a new one to be visualized. So let's try to simulate it; "see" the current entry:


${old table}=    Get Webelement    ${locator for a generic table in the div}   # something like //div/table[@summary=“Task Types“]

Now the value of that variable is going to be a specific webelement - an actual object in the DOM, not the "current <table> tag in the html, in any given moment".

Then, you do the operation that will make the system reload the tables - and wait for the one that was present to disappear:

Operation So Data Is Changed
Wait Until Element Is Not Visible    ${old table}

Once the "Wait For" returns execution/completes, you are sure the old table is no longer visible. And then - you need to wait for the new one to appear:

Wait Until Element Is Visible    ${locator for a generic table in the div}   # something like //div/table[@summary=“Task Types“]

This approach is based off the SeleniumLibrary, and YMMV on the exact operations and locators, but that's the general idea.

Related