Search code examples
protractorng-class

Detect Element using ng-class in protractor


Hi I have an element with class and ng-class attributes, ng-class contains the information of my element(an event created dynamically), i need to verify if event is created on correct date or day. This is how my event looks like on page


Solution

  • element(by.id('1993')).getAttribute('ng-class').then(function (ngClass) {
         var date = new Date().getDate(); //to get today's date
         expect(ngClass).toContain(date);
    });