Geb has very nice function to get value of selected option, but I was not able to find method to get it's text. Fortunately, it is still possible using ugly Selenium API and can be nicely hidden behind Page Object. For example, this is what I have in my Page Object:
And this is how it looks in Spec:
myField {$("#my") }
myFieldValue { new Select($("#my").getElement(0)).getFirstSelectedOption().getText() }
And this is how it looks in Spec:
when:
myField.value('B')
then:
myFieldValue == 'B'
No comments:
Post a Comment