Baz Baz - 1 month ago 8
Javascript Question

Locating ids with forward slashes

I have the following button:

<button id="Organisation/user" class="button-2xhG8" data-reactid=".0.2:$organization.0.0.2:$1/47">org</button>


And I am trying to click on it using:

browser.waitForExist("#Organisation/user",10000)
browser.click("#Organisation/user")


to no avail. The following does work though:

browser.waitForExist(".button-2xhG8",10000)
browser.click(".button-2xhG8")


and I can click on other buttons without don't user forward slashes in their ids. How do I locate the button?

Answer

You'll have to double-escape special characters in attributes

browser.waitForExist("#Organisation\\/user",10000)