Comments for Get Element

Topic for comments about Browser library keyword Get Element

Hi there! I’m using RF v7.0.1 and BL v18.0.0 - pretty awesome stuff!

But I have a situation when I use Get Element and specify the data-testid attribute of an element to search but it can’t find it because the data-testid attribute includes a dot “.” symbol in it.

For example: <span data-testid="some_text.some_other_text">Content</span>

I faced an error: “Keyword ‘Get Element’ failed after retrying for 30 seconds. The last error was: Error: locator.waitFor: DOMException: Failed to execute ‘querySelectorAll’ on ‘Document’: ‘[data-testid=some_text.some_other_text]’ is not a valid selector.”

(I’m using Wait Until Keyword Succeeds in addition to Get Element)

I tried to use querySelector in the browser console and it works just fine:
document.querySelector('[data-testid="some_text.some_other_text"]')
Also, by using querySelectorAll it returns a NodeList with this element successfully:
document.querySelectorAll('[data-testid="some_text.some_other_text"]')

So, I had to use a workaround to find the element using Get Element with “the not strict search”:

Get Element [data-testid*="some_other_text"]

IDK, it might be helpful for somebody.