I am more familiar with Java and Selenium than Ruby and Capybara and SitePrism, so apologies if this question is rather thick.
Selenium has a very useful class for managing Select tags, Selenium::WebDriver::Support::Select, which can be created by passing it the Selenium Element (Selenium::WebDriver::Element) representing the select. I would like to get a Select object so I can use its convenient methods.
Using SitePrism and Capybara, however, the standard method of defining elements gives me access to a select modeled by Capybara's Element class, Capybara::Node::Element, and I can't seem to find an easy way to extract the underlying Selenium Element from the Capybara Element.
I've searched around for alternatives and found Capybara's #select method, but that seems very limiting to me, since it looks like it forces you to select by value and has very narrow parameters for defining the select on the page.
Is there an easy way to create a Selenium Select from SitePrism/Capybara? Or is there a better way of doing this entirely? Thanks!
Ah, I found it. It was right in Capybara::Node::Element all along. The #native method returns the native element from the driver. This can then be passed into the Selenium Select's initialize method to successfully create the Select.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With