https://github.com/watir/watir-webdriver/blob/master/lib/watir-webdriver/elements/generated.rb


to me it looks like it could be possible to just call it something like
without the dashes and then monkey patch

def data_element_id(*args)
  DataElementId.new(self, extract_selector(args).merge(:tag_name =>
"data-element-id"))
end

class DataElementId < HTMLElement
  attributes( whatever_attributes_you_care_about)
end


in selenium you can do something like
driver.find_element(tag_name: "data-element-id")

just guessing it would work like that


On Thu, Aug 9, 2012 at 3:06 PM, Željko Filipin <[email protected]> wrote:

> I would suggest that you post this to [email protected]
>
> Željko
> --
> filipin.eu
>
>
> On Thu, Aug 9, 2012 at 8:28 PM, Abe Heward <[email protected]> wrote:
>
>> If I want to monkey patch Watir to recognize custom HTML attributes
>> ("custom_attrib" in the example code) I just add this code:
>>
>> module Watir
>>
>>  class Element
>>
>>    def custom_attrib
>>
>>      @how = :ole_object
>>
>>      return @o.custom_attrib
>>
>>    end
>>
>>  end
>>
>> end
>>
>> However, take a look at the custom attributes on this div element:
>>
>>
>> <div class="contentauthoring_cell_element" data-element-id="id6775571" 
>> data-element-type="contacts">
>>
>> Notice that those custom items contain dashes.  This is bad, because Ruby
>> does not allow dashes to exist in its method names.
>>
>> So, is Watir simply unable to be monkey-patched for these sorts of custom
>> attributes? If so, that would be really unfortunate because it seems like a
>> pretty common thing to have in HTML nowadays.
>>
>> OTOH, if it can be monkey-patched to support these things, then how?
>>
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> [email protected]
>> http://groups.google.com/group/watir-general
>> [email protected]
>>
>
>  --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to