Facing Issue while validating list of data in Browser Library

validation is not consistent.
it is not reliable solution from browser library
Do we have any other alternative solution for validation of list of data?

Hi Krishna,

It’s not clear what your problem is?

Can you show the test case that’s causing you an issue and the result you are getting, also as you mentioned “validation is not consistent.” can you show an example of the result data when it works as you expect and also when it doesn’t work as you expect so we can see what you mean by “not consistent”

Unfortunately with the information you’ve given it’s hard to know what issue your facing.

Dave.

Robot Framework (Browser Library) is not providing a deterministically reproducible result while validating a large number of items in a table (50 items)

Context:
In the UI a table with several columns is visible.
Now we want Robot Framework to fetch the values of all items from one specific already sorted column (sorting has been done by UI functionality).
Then Robot Framework is supposed to put the fetched data into a list.
This list is now sorted again by the sorting method provided by Robot Framework.
Now the system compares the list sorted by Robot Framework with the list which has been intially fetched from the UI.
The expected result is that both lists should match.

Problem: Sometimes the verification fails and sometimes it passes (with same data and same test implementation).
This means this test case does not provide a reliable result.

Might this inconsistent verification result related to the amount of data that we want to be verified?
We assume that maybe there is a limitation regarding the amount of items the system is able to handle while creating the lists?

Related to that another question:
For fetching items (or specific values of items) from a table - is it neccessary that all items are already visible?
Or is the system also able to fetch items that are only accessible via scrolling down within the table?
Can you please provide clarification?

Hi Krishna,

I tried to reproduce what you described with this example:

*** Settings ***
Library 	Browser
Library 	Collections

Test Template 		50 values from table with Browser


*** Test Cases ***
50 values from table with Browser A 	1
50 values from table with Browser B 	2
50 values from table with Browser C 	3

*** Keywords ***
50 values from table with Browser
	[Arguments] 	@{args}
	New Browser 	chromium
	New Page 	about:blank
	Go To 	https://www.bu.edu/tech/services/cccs/websites/www/wordpress/how-to/sortable-searchable-tables/
	Take Screenshot
	VAR 	${th_Athlete} 	//table[contains(@class,"searchable")]//tr/th[text()="Athlete"]
	VAR 	${tbl_Athlete} 	//table[contains(@class,"searchable")]
	Scroll To Element 	${th_Athlete}
	Take Screenshot
	Click 	${th_Athlete}
	Take Screenshot
	@{datalist}= 	Create List
	${rows}= 	Get Element Count 	${tbl_Athlete}//tr[td]
	FOR 	${i} 	IN RANGE 	${rows}
		${e}= 	Get Table Cell Element    ${tbl_Athlete}    0    ${i + 1}
		${val}= 	Get Text 	${e}
		Append To List 	${datalist} 	${val}
	END
	Log 	${datalist}
	${listcopy}= 	Copy List 	${datalist}
	Sort List 	${listcopy}
	Lists Should Be Equal 	${datalist} 	${listcopy}

I reproduced the symptom but I’m not sure if it’s Browser Library’s fault.

I noticed every time it failed, I could see from the screen shot the table had failed to sort. Simply adding a sleep of 1 second before the click on the header row to sort the table, allowed the test to run reliably

So this is the working example:

*** Settings ***
Library 	Browser
Library 	Collections

Test Template 		50 values from table with Browser


*** Test Cases ***
50 values from table with Browser A 	1
50 values from table with Browser B 	2
50 values from table with Browser C 	3

*** Keywords ***
50 values from table with Browser
	[Arguments] 	@{args}
	New Browser 	chromium
	New Page 	about:blank
	Go To 	https://www.bu.edu/tech/services/cccs/websites/www/wordpress/how-to/sortable-searchable-tables/
	Take Screenshot
	VAR 	${th_Athlete} 	//table[contains(@class,"searchable")]//tr/th[text()="Athlete"]
	VAR 	${tbl_Athlete} 	//table[contains(@class,"searchable")]
	Scroll To Element 	${th_Athlete}
	Take Screenshot
	sleep 	1
	Click 	${th_Athlete}
	Take Screenshot
	@{datalist}= 	Create List
	${rows}= 	Get Element Count 	${tbl_Athlete}//tr[td]
	FOR 	${i} 	IN RANGE 	${rows}
		${e}= 	Get Table Cell Element    ${tbl_Athlete}    0    ${i + 1}
		${val}= 	Get Text 	${e}
		Append To List 	${datalist} 	${val}
	END
	Log 	${datalist}
	${listcopy}= 	Copy List 	${datalist}
	Sort List 	${listcopy}
	Lists Should Be Equal 	${datalist} 	${listcopy}

Hopefully that helps,

Dave.

Hi,

Also those tables may have attributes for the arrow up, down or double arrow display in the header.

You could wait for this attribute to be displayed i.e. the table is sorted as expected. Even use a Run Until Keyword Suceed (to display arrow down for example).
Then question is always the same, is this solution not hiding a incorrect behavior of the page.

Regards.
Charlie

1 Like