The page object gem already supports selecting by partial text:
page.planPurchase = /Basic/
puts page.planPurchase
#=> "Monthly Basic Plan - $27.99"
Selecting by value is also supported by using select_value
:
page.planPurchase_element.select_value('5')
puts page.planPurchase
#=> "Monthly Basic Plan - $27.99"
The page object gem supports selecting options by index using []
. Note that you have to use .click
as there is no .select
. The index is 0-based.
page.planPurchase_element[2].click
puts page.planPurchase
#=> "Monthly Business Plan - $54.99"