Hi Jeff,
Hash keys are immutable, and therefore represented by Symbol instances by Ruby
convention. The parameter passed into the method to obtain the value is not
immutable, and therefore represented as a String instance. There is no
exception because Ruby does not do any type checking by default. We could
either do a String conversion or throw an argument error, I'm not sure which is
better, honestly. Create an issue on watir github page with your preference
and we can discuss the best way to handle it. Better yet, if you can figure out
how to do that in the attribute value method yourself you can make a pull
request and become a contributor to the protect as well. :)
On Friday, June 8, 2018 at 4:48:14 PM UTC-5, Jeff Fagot wrote:
> Hello all,
>
>
> I am using watir (6.10.2).
>
>
> GIVEN HTML :
> <div class="Dashboard_Widget_Toolbar_Item"
> data-widgetapplicationid="Authentication.Application.431"
> data-widgetconfigure="What I Want">
>
>
>
> Because I am using PageObject, I have been used to create page elements using
> custom attribute as so:
>
>
> PAGEOBJECT ELEMENT DEF: Where I simply replace the iphen by an underscore
> ("-" => "_")
> self.div(:my_widget, data_widgetconfigure: "What I Want")
>
>
> Now you see me coming, when I wanted to validate the value of my attribute, I
> came across the below:
> @browser.my_widget_element.attribute_value(:data_widgetconfigure).nil?
> # => true
>
>
> While the correct way seems to be:
>
> @browser.my_widget_element.attribute_value("data-widgetconfigure").nil?
> # => false
>
>
> My question is to know as to why can't I use the first validation but more
> importantly why is it not erroring out?
>
>
> Thanks
> Jeff
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
In short: search before you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.