I started learning how to use casperJs
. And have some troubles:
- I want to select grid cell by
innerHTML
.
in my test I write method which should return selector of cell, but it always returns null.
function getAlertInGridByInnerHTML(htmlString) {
var rezultCell = casper.evaluate(function () {
var gridChilds = document.querySelector('div[id^="scheduler-alert-grid"]').getElementsByTagName('div');
for (i = 0; i < gridChilds.length; i++) {
var childDiv = gridChilds[i];
if (childDiv.innerHTML == htmlString) {
return childDiv;
}
}
});
return rezultCell;
};
I call this function in this way:
casper.test.begin('Test double click activity assigned alert', function suite(test) {
this.mouse.down(getAlertInGridByInnerHTML('BLUE ALERT'));
casper.run(function () {
test.done();
});
});
maybe someone can explain where is problem? When I run same code (which is inside evaluate
function div is find).