Permalink
Browse files

normalize spaces when testing text values

  • Loading branch information...
ebrehault committed Aug 2, 2012
1 parent c959e75 commit 94d90451f91d2b0014dd616794f3113dbd0d307d
Showing with 2 additions and 2 deletions.
  1. +2 −2 casper.js
View
@@ -240,7 +240,7 @@ CasperRenderer.prototype.getControlXPath = function(item) {
CasperRenderer.prototype.getLinkXPath = function(item) {
var way;
if (item.text)
- way = 'text()=' + this.pyrepr(this.normalizeWhitespace(item.text));
+ way = 'normalize-space(text())=' + this.pyrepr(this.normalizeWhitespace(item.text));
else if (item.info.id)
way = '@id=' + this.pyrepr(item.info.id);
else if (item.info.href)
@@ -393,7 +393,7 @@ CasperRenderer.prototype.checkText = function(item) {
if ((item.info.type == "submit") || (item.info.type == "button")) {
selector = 'x("//input[@value='+this.pyrepr(item.text)+']")';
} else {
- selector = 'x("//*[text()='+this.pyrepr(item.text)+']")';
+ selector = 'x("//*[normalize-space(text())='+this.pyrepr(item.text)+']")';
}
this.waitAndTestSelector(selector);
}

0 comments on commit 94d9045

Please sign in to comment.