0

I am having issues locating the text of start and end times on our web application using page objects. Below is the code, the only thing that will change is the time (in between ::before and ::after).

How can I locate the class in the page object?

<dd ng-class="pdfView ? 'col-xs-9' : ''" class="byt-start-time ng-binding ng-scope" ng-if="!byt.bytID.timeStartText">9:00 PM</dd>

1 Answer 1

1

Taking into account the given HTML, relying on a byt-start-time class should work:

var startTime = $(".byt-start-time");
startTime.getText().then(console.log);
10
  • I'm using expect(itinerary.startTime.getText).toContain('8:00 AM'); itinerary.startTime.getText().then(console.log); but receiving a failure: Expected Function to contain '8:00 AM'. 8:00 AM is being logged correctly to the console, so I'm not sure why its still failing. Ideas?
    – kylokyler
    Jul 24, 2017 at 19:43
  • @Kelsey make sure to call getText() - notice the parenthesis. Thanks
    – alecxe
    Jul 24, 2017 at 20:49
  • @Kelsey hey, have you got it working eventually? Thanks.
    – alecxe
    Jul 29, 2017 at 1:22
  • Unfortunately it's still not working. Either getText is not working correctly or I receive the error "A jasmine spec timed out. Resetting the webdriver control flow"- neither make sense because the correct value displays in the console.
    – kylokyler
    Jul 31, 2017 at 13:22
  • @Kelsey okay, but have you tried calling the method as I've proposed: expect(itinerary.startTime.getText()).toContain('8:00 AM');
    – alecxe
    Jul 31, 2017 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.