I’m hoping for some help, perhaps someone has got a solution for my current predicament which is currently doing my head in.
I’m trying to insert text into a input box (I have several) but am unable to. The element is shadow root nested 2 down. Though both shadow roots are open.
I am able to click on button elements located in the same shadow root but am simnply unable to insert text.
The interesting part is the identifier of all the text boxes are separated by a period (.)
The id of the element: streetAddress.quickSearch
the js path: document.querySelector(“#appContainer > card-replacement-miniapp”).shadowRoot.querySelector(“div > div > div:nth-child(2) > miniapp-party-profile-management”).shadowRoot.querySelector(“#streetAddress.quickSearch”)
in my karate feature i’ve tried the jspath (as below), the selector, the xpath (both relative and full) but it continues with the same error
* script("document.querySelector('#appContainer > crma').shadowRoot.querySelector('div > div > div:nth-child(2) > ppma').shadowRoot.querySelector('#streetAddress\.quickSearch').value='1234'")*
error: org.graalvm.polyglot.PolyglotException: js eval failed twice:document.querySelector(‘#appContainer > card-replacement-miniapp’).shadowRoot.querySelector(‘div > div > div:nth-child(2) > miniapp-party-profile-management’).shadowRoot.querySelector(‘#streetAddress.unitNumber’).value=’1234′, error: [type: MAP, value: {type=object, subtype=error, className=TypeError, description=TypeError: Cannot set properties of null (setting ‘value’)
Unsure if has any issue but I do find it interesting is that the console output lists the query selector path with a value of ‘#streetAddress.unitNumber’ -> note the single “” -> however it is submitted with a double “”
Also note there is no difference in behaviour if I add an additional -> “”, or use only a single “” or no slash at all.
Is there any suggestions on how to access an attribute id which is contains two values and is separated by a (.)
i.e. #streetAddress.quickSearch
I’ve looked at all the documentation, the other stack overflow posts and also the tutorial found at https://www.youtube.com/watch?v=O76h9Hf9-Os but I’m absolutely stuck.
Thanks
JB18