Flakiness fix when checking for displayed element

Made a change to combat flakiness when checking for an element to be displayed
the {....} braces are not necessary here, consider removing them