You can use a CSS2 attribute selector instead of a geb attribute selector 
and it will be just as fast class or ID selectors (because it is executed 
by the browser rather than returning all possibilities and filtering in 
Geb).

For your example you should be able to do this:

$("form [data-qa='artist']") = "1"
$("form [data-qa='artist']") = 2
$("form [data-qa='artist']") = "Alexander"

On Thursday, June 16, 2016 at 10:02:43 AM UTC-6, micha.kutz wrote:
>
> You should not do this since all attribute based selectors are much slower 
> than class or ID based ones.
>
> We do something similar, but use "qa" prefixed classes instead.
>
> Kind regards
> Micha
>
> Rich Crook <[email protected] <javascript:>> schrieb am Do., 16. Juni 
> 2016, 17:58:
>
>> Hi Marcin,
>>
>> Ok an example is better, given:
>>
>> <form>
>>     <select data-qa="artist">
>>         <option value="1">Ima Robot</option>
>>         <option value="2">Edward Sharpe and the Magnetic Zeros</option>
>>         <option value="3">Alexander</option>
>>     </select>
>> </form>
>>
>> We select options with...
>>
>> $("form").attr('[data-qa="artist"]') = "1" 
>> $("form").attr('[data-qa="artist"]')  = 2 
>> $("form").attr('[data-qa="artist"]')  = "Alexander"
>>
>> Right?
>>
>> Thanks,
>> Rich
>>
>> On Wednesday, June 15, 2016 at 11:37:09 PM UTC-7, Marcin Erdmann wrote:
>>
>>> Rich, can you please explain what you mean by using data-* attributes 
>>> directly? Are you asking how to access them? If that's the question then 
>>> you can use something like $("element selector").attr("data-name").
>>>
>>> On Thursday, 16 June 2016, Rich Crook <[email protected]> wrote:
>>>
>>>> Hello,
>>>>
>>>> Is it possible to directly use the data-* attributes only without using 
>>>> the element tag name?
>>>>
>>>> Thanks!
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Geb User Mailing List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/geb-user/5bd0ee91-69d4-459f-b62d-1cf8ea8a17f6%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/geb-user/5bd0ee91-69d4-459f-b62d-1cf8ea8a17f6%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Geb User Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/geb-user/7c5f3c36-54c6-4562-b50e-a0dbb8edc992%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/geb-user/7c5f3c36-54c6-4562-b50e-a0dbb8edc992%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/23d2dbd2-ead3-4b63-9080-1214946d92e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to