There is an element <label class="CI-MultiplePickerList-column-name-img_logout CI-MultiplePickerList-LAB" style="display: inline;"/> with CSS locator
.CI-MultiplePickerList-column-name-img_logout.CI-MultiplePickerList-LAB This element can have two statuses - when visible to the user and when not visible.
Problem: After clicking on this element, when it has the status displayed: false (that is, when it is not visible to the user), the test crashes and an error appears:
Element should be visible {.CI-MultiplePickerList-column-name-img_logout.CI-MultiplePickerList-LAB} Element: '<label class="CI-MultiplePickerList-column-name-img_logout CI-MultiplePickerList-LAB" displayed:false></label>' I tried to catch the error through exception:
try { $(By.cssSelector(".CI-MultiplePickerList-column-name-img_logout.CI-MultiplePickerList-LAB")).click(); } catch (ElementNotFound e){ System.out.print("Not logged in profile"); } but it did not help.
How can you solve this problem so that the test does not fall when you click on an element with the property displayed: false?