Search code examples
ruby-on-railsrubyseleniumcapybara

Clicking on a editing button in capybara?


I'm trying to click on this specific edit button. I'm using find method in ruby to do so, the problem I'm running into is that It's not able to find the specific element.

<i ng-click="grid.appScope.editMOO(row.entity._id)" class="ca ca-pencil-square-o" role="button" tabindex="0"></I>

Here is my code trying to click on the edit button.

find('.ng-click', class: 'ca ca-pencil-square-o').click

Solution

  • To click on the desired button you can use either of the following Locator Strategies:

    find('i[ng-click^="grid.appScope.editM"]').click
    

    or

    find('i[ng-click^=grid.appScope.editM]').click