Use Capybara to click link in Bootstrap split-button -


When I use Capibara (latest, 2.4.x), how can I click on the 'Last 100 Closed Accounts' link?

Bootstrap (Latest 3.2) in Split Button Below? Ignore ng-click as this is an AngularJS instruction.

  & lt; Div class = "btn-group" & gt; & Lt; Button ng-click = "Recent (50)" class = "BTN BTN-Default" & gt; & Lt; I class = "fa f-refresh" & gt; & Lt; / I & gt; Refresh & lt; / Button & gt; & Lt; Button class = "BTN BTN-default dropdown-toggle" data-toggle = "dropdown" & gt; & Lt; Span class = "caret" & gt; & Lt; / Span & gt; & Lt; Span class = "sr-only" & gt; Toggle dropdown & lt; / Span & gt; & Lt; / Button & gt; & Lt; Ul class = "dropdown-menu" role = "menu" & gt; & Lt; Li & gt; & Lt; An NG-Click = "Recent (200)" & gt; Previous 200 open accounts & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; An NG-Click = "Recently (300)" & gt; The last 300 opened accounts & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "divider" & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; One ng-click = "off (100)" & gt; The last 100 closed accounts & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; After dragging too many hair, I finally found out how Capepara chose to divide. The last list option in the button. First of all, I added  id = "refresh_list"  to the toggle button. I added an ID for the target list  id = "last_100_closed_accounts" . Find the trick in the following order (note the  a  prefix on ID), which is actually two steps: 

  find click_button "refresh_list" ("# last_100_closed_accounts"). Click  

  & lt; Div class = "btn-group" & gt; & Lt; Button ng-click = "Recent (50)" class = "BTN BTN-Default" & gt; & Lt; I class = "fa f-refresh" & gt; & Lt; / I & gt; Refresh & lt; / Button & gt; & Lt; Button class = "btn btn-default dropdown-toggle" data-toggle = "dropdown" id = "refresh_list" & gt; & Lt; Span class = "caret" & gt; & Lt; / Span & gt; & Lt; Span class = "sr-only" & gt; Toggle dropdown & lt; / Span & gt; & Lt; / Button & gt; & Lt; Ul class = "dropdown-menu" role = "menu" & gt; & Lt; Li & gt; & Lt; An NG-Click = "Recent (200)" & gt; Previous 200 open accounts & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; An NG-Click = "Recently (300)" & gt; The last 300 opened accounts & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "divider" & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; An id = "last_100_closed_accounts" ng-click = "off (100)" & gt; Last 100 Closed Accounts & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;  

Cheers! Hopefully this answer will save others from losing your hair: -)


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -