18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
how to check that an element does not have a certain style
Hi
I use JS to hide/show certain rows of a table and I want SAHI to check that the correct row are hidden or not
When they are hidden the display:none style is added to them and to show them again the style is removed altogether.
It is easy to check that a row has display set to none
Cheers
Tom
I use JS to hide/show certain rows of a table and I want SAHI to check that the correct row are hidden or not
When they are hidden the display:none style is added to them and to show them again the style is removed altogether.
It is easy to check that a row has display set to none
_assertTrue(_style(top.document.getElementById('row_1'), 'display') == 'none');
but how do I check that an element doe snot have the display style. When I try the following code I just get a [Exception] [object Error]_assertTrue(_style(top.document.getElementById('row_1'), 'display') != 'none');
Any ideas?Cheers
Tom
Comments
I mean the fact that the display style property does not exist and throws an error is good enough for me in indicating that display:none is not set. But all I need to a way to capture the error and verify that we are expecting an error.
Could you tell us which browser version you are using, and may be show the table html?
To see if element itself has not been set you could try:
_assertEqual('', top.document.getElementById('row_1').style)