1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this is the way!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.