How to extract visible text from webpage with selenium webdriver using ruby

I’m working with Selenium Webdriver using ruby.

I have a dropdown and after each value/text selected inside it, I want
to extract that value/text visible on webpage interface without html
tags, because for that value selected, in div > option tag I do not have
a specific attribute for it, to figure out which is the value, can I do
that in selenium webdriver using ruby?

HTML code:

Please select Social only Social including commuting to a single place of work Business use by you

More details:

I’ve tried this method and it’s working if you select previous some
value, but in my case I have some bug in my dropdown values, something
like this: have 5 dropdowns one after another, and each of them is
depending on the previous dropdown, so if i begin to fill the form like
this:

1). select value at first dropdown (take the text)

2). select at the second dropdown some value (take the text)

3). select at the third dropdown some value (take the text)

4). select at the fourth dropdown some value (take the text)

5). select at the fifth dropdown some value (take the text) (this
dropdown is generated by the previous fourth dropdowns values) - now the
second value of dropdown is changed on the interface webpage. (so here I
cant put element.text for the second dropdwon because it extract the
value I have selected point 2).

I want to check if after each selecting value the previous value remain
the same on the webpage inteface, in my case I have some bug at this.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs