Capybara: is there opportunity to pass Capybara::Node::Element to jquery? -
i try write code can used while page has lot of elements same selectors , values. need things particular element capybara not know - add or remove class, change background color.
when need select particular element many array of capybara::node::element after searching of .all, example. there opportunity pass 1 of such elements jquery in understandable format jq?
simple passing same way pass css selectors gives error
unknown error: syntax error, unrecognized expression: #<capybara::node::element:0x00000003e60d90>
alternatives known me
:nth-of-type() /which tried, , did not work stable me, still cannot understand why worked in majority of cases/
straight in jquery: collecting similar selectors array, slicing through , making stuff need. acceptable, has disadvantage: provides more scripts in capybara.
is there chance straightly pass result of search of .all jquery or other alternatives?
p.s. resuming briefly, issue 1 result can understandable both capybara , jquery. when looping through similar elements have global counter number of necessary one. have provide different code basing on whether used capybara (here can capybara::node::element) or jscripts (here have add slicing initial selector).
there no way in capybara pass elements browser executing script (due compatibility across drivers), of drivers support it. if using selenium driver in capybara, passed elements available in arguments 'array', can this
el = page.find(:css, '#my_id') page.driver.browser.execute_script("$(arguments[0]).addclass('something');", el.native)
Comments
Post a Comment