Jump to content

How to find an element using attribute that has special characters in it


Recommended Posts

Hi, i have a site that has shadow root in it, and i am trying to find an element that has a specific attribute in it which is:

<test-accordion accordion-list="[{"name":"test","label":"testname"}]"></test-accordion>

When I tried:

_WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "test-accordion[accordion-list="[{'name':'test','label':'testname'}]"]", $test2)

it's returning this error message for that specific line:

_WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "test-accordion[accordion-list="[{'name':'test','label':'testname'}]"]", $test2)  ==> Unable to parse line.: 

Appreciate any help that I can get, or if there are any alternative approach.

Link to comment
Share on other sites

Compare the line below to your original line to see the differences.  Then read the Help file's section on strings to understand why the line below is able to be parsed correctly.

_WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "test-accordion[accordion-list=""[{'name':'test','label':'testname'}]""]", $test2)

 

Edited by TheXman
Link to comment
Share on other sites

Thanks, it all makes sense now. I just modified the line (see below), and it now worked!

_WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "test-accordion[accordion-list='[""name"":'test"",""label"":""testname""}]']", $test2)

 

Edited by Hermes
Link to comment
Share on other sites

11 hours ago, Hermes said:

Thanks, it all makes sense now.

You're welcome.  I'm glad that you were able to figured it out.  :thumbsup: 

Knowledge that you figure out on your own is usually retained longer than when you are just provided the answer.  :idea:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...