Question

I have a set of select lists, checkboxes that have similar properties. I have them under the indexed_property. I was able to select the values from the select_list without any problem. However, when I use the check_myindexpropitem.mycheckbox, I get an error

NameError: undefined local variable or method `check_myindexpropitem' for #<myPage:0x3393588>.

I get a true returned for check_myindexpropitem.mycheckbox_element.enabled?

Page object code:

indexed_property(:myindexpropitem,
  [
    [:select_list, :myselectlist, {:id => 'drpV%sselect1'}],
    [:checkbox, :mycheckbox, {:id => 'checkV%scheckone'}]
  ])

Script:

if myindexpropitem[i].mycheckbox_element.enabled?  # i is from the for loop
  check_myindexpropitem[i].mycheckbox
end
Was it helpful?

Solution

The check_ is in the wrong spot.

Remember that myindexpropitem is the method that just returns the object that responds to []. The method check_mycheckbox is what is defined for the indexed element that is returned by myindexpropitem[i].

The script code should be:

if myindexpropitem[i].mycheckbox_element.enabled?  # i is from the for loop
  myindexpropitem[i].check_mycheckbox
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top