Solution 1 :

Maybe the HTML has iframe,
If it has, you can use Select Frame keyword in SeleniumLibrary.

HTML frames are used to divide your browser window into multiple sections where each section can load a separate HTML document

If we’re not lucky, try this one Wait Until Page Contains Element or maybe you can optimize the xpaths more.

Problem :

I need to switch to element that is coded as <div class="error-wrapper">.
It contains text which coded as <span class="error-content">Some text here.</span>
It can be closed by clicking x button which coded as <span class="glyphicons glyphicons-remove">.

I’ve figured the xpaths for each element.

So I need to find the error-wrapper element somehow, click close button and switch to other elements on the webpage.
I’ve tried Page Should Contain, Element Should Be Visible, Page Should Contain Element, …

The problem is the test is failing with error: “Window with last index is same as the current window.”

How can I switch to this “window” and switch back to main window? It’s not an alert or a popup or a window.

Screenshot of HTML