Currently there is no out of box solution in the Robot Framework libraries on how to wait until the element is visible on the page in shadow DOM. I came up with one approach. Perhaps it will be useful for others.
I created a keyword:
Verify ShadowDom Element Visible
[Arguments] ${Element}
register keyword to run on failure Capture Page Screenshot
${previous_kw}= register keyword to run on failure Nothing
FOR ${index} IN RANGE 1 30
sleep 1s
${status2}= Run Keyword and return Status execute javascript return ${Element}.checkVisibility();
IF '${status2}'=='False' CONTINUE
... ELSE BREAK
END
register keyword to run on failure ${previous_kw}
IF '${status2}'=='False' Capture Page Screenshot
IF '${status2}'=='False' Fail Element not visible after 30 sec.
Verify ShadowDom Element Visible document.querySelector("xxxx-block-wizard-footer").shadowRoot.querySelector(".xxxx-block-wizard-footer__cta-primary").shadowRoot.querySelector("button")
In this case, we are expecting some button in shadow DOM to appear on the page within 30 seconds. If button did not appear, a screenshot would be captured and a fail message will be sent to log.
Note: If the button is visible, no screenshot is taken on all the failed attempts to verify. Good luck.