Index: pkg/webdriver/lib/webdriver.dart |
diff --git a/pkg/webdriver/lib/webdriver.dart b/pkg/webdriver/lib/webdriver.dart |
index 837836bd4c49944df5e550f69392d0864bd773d6..17b095304bbe24c16fcb0699b5393af2bf1992d5 100644 |
--- a/pkg/webdriver/lib/webdriver.dart |
+++ b/pkg/webdriver/lib/webdriver.dart |
@@ -282,15 +282,14 @@ class WebDriverBase { |
results = sbuf.toString().trim(); |
// For some reason we get a bunch of NULs on the end |
// of the text and the json.parse blows up on these, so |
- // strip them. We have to do this the hard way as |
- // replaceAll('\0', '') does not work. |
+ // strip them. |
// These NULs can be seen in the TCP packet, so it is not |
// an issue with character encoding; it seems to be a bug |
// in WebDriver stack. |
for (var i = results.length; --i >= 0;) { |
- var code = results.charCodeAt(i); |
+ var code = results.codeUnitAt(i); |
if (code != 0) { |
- results = results.substring(0, i+1); |
+ results = results.substring(0, i + 1); |
break; |
} |
} |