I'm currently working on a UI test for a page that contains two buttons. While I can easily target these buttons, I am struggling to locate the unique selector assigned to describe each button. In my test spec file, I am validating the response and referring to a class method file where I am specifying the element's location.
My primary query is whether there is a possible way to pinpoint the "Send Club Assignment" string, even though it seems inaccessible as it is not within the text element I am matching but nested in a
I have attempted various solutions including:
Trying to include both class and text selector in the class method file:
send_club_assignment_button, "button", class: "se-button--medium", text: "Send Club Assignment"
But received the following error:
Capybara::ElementNotFound:
Unable to find visible css "button" with text "Send Club Assignment" and classes [se-button--medium]
Experimenting with multiple lines in the class file:
element :send_club_assignment_buttons, "button", class: "se-button--medium" element :send_club_assignment_button, send_club_assignment_buttons.last
Trying to modify the test file:
click_on(profile_memberships_tab.last(send_club_assignment_button)).click
Despite these attempts, all variations led to the same outcome:
Capybara::Ambiguous: Ambiguous match, found 2 elements matching visible css "button" with classes [se-button--medium]