5

I am trying to use the Geb jQuery selector on the following element:

<li data-title="Something"><'li>

I have tried the following:

//1
$("li", "data-title": "Something")
//2
$("li", data-title: "Something")

But neither work. Is this possible?

jdfolino
  • 307
  • 2
  • 14
  • 1
    You're using `$("li", "data-title": "Some value")` yeah? Not `Something`? – tim_yates Feb 27 '15 at 08:45
  • I just wrote a quick check in Geb's codebase to confirm that these kind of attributes can be used to select elements with. Are you sure that the element exists in the page when you're trying to select it? Seeing an attribute name prefixed with `data-` makes me believe that you're using some kind of js framework for single page applications, is that right? – erdi Feb 27 '15 at 17:08
  • @tim_yates yes we are using a MVC framework, AngularJS – jdfolino Mar 02 '15 at 02:39

1 Answers1

6

You can just use the CSS selector for a custom attribute for this:

$("li[data-title='Something']")
jk47
  • 755
  • 4
  • 10