tabermike
tabermike

Reputation: 33

Get Selenium Element from Watir Element

This might seem like a strange request, but here goes anyhow. Using Watir, I find an element.

Example element: "#<Watir::Div: located: false; {:id=>\"searchFieldOptions\", :tag_name=>\"div\"}>"

One of the external tools I'm wishing to use only supports Selenium elements. Is there a way to get a Selenium element from the Watir element?

If I find my element with: field_options = @browser.driver.find_element(:id => 'searchFieldOptions')

I can get the Selenium element: "#<Selenium::WebDriver::Element:0x671e64fc531f7284 id=\"758f274f-c4f1-40d7-a7eb-b472705361e7\">"

I can work with this, but life would be easier if I could locate the element(s) just once.

Upvotes: 1

Views: 138

Answers (1)

tabermike
tabermike

Reputation: 33

Well, color me embarrassed. I thought I had tried this already, but either i didn't or had a typo or?

Anyhow, once I find my element: my_watir_element.wd gives me what I need.

Upvotes: 1

Related Questions