Got a button that changes state when clicked on. But, I cannot "find the button, even when in it's default state.:

Source code:

 <div class="alert alert-warning" ng-hide="show_cd_only">
 <div class="btn btn-inverse" ng-click="requestCD()">Only Disclose Via  CD</div>
 <p>Click here to specify that all future disclosures for this loan should be sent via CD instead of LE. If a CD has already been sent, no LEs will be sent regardless of this button action.</p>

Page Object Source:

class ClosingValidationsReportsPage < GenericBasePage
include DataHelper

element(:onlyDiscloseViaCD) {|b| b.button(xpath: "//div[@id='main']/div/div/div/div/div/div[2]/div/div/div/span/div/div")}
element(:allowLEDisclosures) {|b| b.button(xpath: "//div[@id='main']/div/div/div/div/div/div[2]/div/div/div/span/div[2]/div")}
element(:message) {|b| b.element(xpath: "(//div[@id='flash']/div)[2]")}


Selenium-Cucumber source:

And(/^you click on Only Disclose Via CD button$/) do


 Watir::Wait::TimeoutError: timed out after 30 seconds, waiting for {:xpath=>"//div[@id='main']/div/div/div/div/div/div[2]/div/div/div/span/div/div", :tag_name=>"button"} to become present
 ./features/step_definitions/closing_interaction.rb:91:in `/^you click on Only Disclose Via CD button$/'
 ./features/CTMWEB-5238-CTM Web - Closing Validation Screen - Disclosure Indicator.feature:9:in `And you click on Only Disclose Via CD button'

Button States:

enter image description here

Second state pops up a message that I would need to assert is present once buttons is clicked.

  • You need to show us HTML that is presented in the page (the actual 'code' in 'source code'. Only then can we figure out what's wrong with trying to work with it. Right now we only have half the picture. Thanks. – Michael Durrant Jun 16 '16 at 20:47
  • Also recommend you play around finding the element in the browser console and be sure you have a methods that works from there. – Michael Durrant Jun 16 '16 at 20:48
  • HTML for this was already in the question- however due to poor formatting it was not showing up. I have re-formatted it, and now HTML is visible in the question. – demouser123 Jun 17 '16 at 8:50
  • What if you define it as an element instead of a button, does your code see it then? I mean this part "b.button()". – David Cain Jun 17 '16 at 22:12
  • Yeah, thanks Dave, I tried all those things. It's perplexing, because it "should" work as it is. – John McGrath Jun 19 '16 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.