当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby - Extract capybara element/object from Selenium element

问题描述:

I had to identify few web elements in a page through its class value or name value. But as the Capybara::Node::Finders#find supports only css and xpath as locator I did this(Converted Capybara element to Selenium element):

element = page.driver.browser.find_element(:class,locatorValue)

Now i'm able to fetch the element with class value as I'm using Selenium element underneath. But this compells me to use only webdriver apis and not capybara apis

For eg: I have to go for element.send_keys 'input' instead of element.set 'input' or element.fill_in 'input'

Is there any way I can get back a Capybara element from Selenium element?? The reverse of what I have done in getting Selenium object earlier??

分享给朋友:
您可能感兴趣的文章:
随机阅读: