I am using protractor to write my tests and when I search the attribute of an element it works except with "data-" attributes:
ptor.findElement(protractor.By.css('.wrap.loaded'))
.then(function(thumb) {
thumb.getAttribute('data-width')
.then(function(w) {
... //*w == null*
});
});
As I said, if I have a non data attribute, it works fine:
ptor.findElement(protractor.By.css('.wrap.loaded'))
.then(function(thumb) {
thumb.getAttribute('class')
.then(function(c) {
... //*c == wrap loaded*
});
});
Does anyone know why it happens and if there is a way to get the data attributes from a Wedriver.WebElement in javascript? Thanks.