I try to check is selected option realy selected in drop down list (select):
expect(page.sltMembers_element.options).to eql('John Doe')
But I get an error that expected: 'John Doe' and got: list of all options from drop down list.
Assuming that the sltMembers_element
method is the one generated by the select_list
accessor, then the page-object will have 5 methods:
sltMembers
returns the currently selected item text.sltMembers=
selects an item.sltMembers_element
returns the page-object element.sltMembers?
checks if the element is present.sltMembers_options
gets an array of all available options.As you want to check the selected option, you want to call the page's sltMembers
method:
expect(page.sltMembers).to eql('John Doe')