Find method returns a PO element, You are calling puts on that, so the result makes sense.
If you move your puts into the block it will print the value you are looking for. On Thu, Oct 25, 2018, 4:56 AM NaviHan <[email protected]> wrote: > Found this really confusing behavior while dealing with this element. > Basically I want to get the value > > <input type="hidden" name="pid" value="9351785049816"> > > > > I have declared the pageobect as below > > hidden_fields(:test, :name => 'pid') > > > And trying to print the value actually prints the pageobject instead of > the value. > > puts test_elements.find {|el| el.value} > > #<PageObject::Elements::HiddenField:0x0000000005942618> > > > So I did a "value.value" and Watir complained as > NoMethodError: undefined method `value' for "9351785586540":String > > Any clue why this strange behavior. Is this a limitation of PageObject? > > > -- > -- > 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. > -- -- 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.
