ruby on rails - capybara: within scope does not restrict actions to inside of that element -
there multiple similar kind classes , buttons trying click on button inside particular class using code
within(first(locator, text: text))do scroll_to(first('button')) first('button').click end
from
<div class="some parent class"> <div class="some other class" id="1"> <div class="class1">......</div> <div class="class2">......</div> <div class="class of button">......</div> </div> <div class="class used inside within" id="2"> <div class="class1">......</div> <div class="class2">......</div> <div class="class of button">......</div> </div> </div>
but when run above code clicks similar kind of button inside class other class
, not used inside within. suggestion should make work.
also check have run first(locator, text: text)
, path of found element path of class <div class="class used inside within" id="1">
ok working. infact using page.execute_script("$('button').click()") click on button in code seems not restricted particular class using within. clicked pure capybara code without script , clicks on correct button now
Comments
Post a Comment