ruby - Find element with attribute with value starting with an integer in capybara selenium -
I was trying to find an element with the element whose value is starting with an integer < / P>
& lt; Div data-id = 2009ac> ... & lt; / Div & gt; And I use the CSS locator below to locate the element
page.find ("div [data-id = 2009ac]" ) I think the element is not found or the exception is telling an invalid locator
How to find such elements?
We need to work with the quotation marks when it starts with integer < / P>
page.find ("div [data-id = '200 9' ']") This will not work for features like ID and class . And for specialty values that do not begin with integers, we can use it without quotation marks without having to use it. For example
& lt; Div data-id = a2009ac & gt; ... & lt; / Div & gt; To find the above element, we can use
page.find ("div [data-id = a2009ac]") < / Code>
Comments
Post a Comment