This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
$("option").getText() does not remove leading and trailing whitespace in Chromium #2759
Open

Description
var url = "http://127.0.0.1/";
describe("", function () {
it("", function () {
browser.get(url);
expect($("option").getText()).toEqual("test");
});
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<script data-require="[email protected]" src="https://code.angularjs.org/1.4.8/angular.js" data-semver="1.4.8"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<select>
<option> test </option>
</select>
</body>
</html>
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
});
Actual result:
$ ./node_modules/.bin/protractor
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.8.104:47480/wd/hub
Started
F
Failures:
1)
Message:
Expected ' test ' to equal 'test'.
Stack:
Error: Failed expectation
at Object.<anonymous> (/tmp/protractor/spec.js:6:39)
at process._tickCallback (node.js:356:9)
1 spec, 1 failure
Finished in 4.334 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
Expected result: the test passes
(I am not sure whether it isn't actually a bug in Selenium but since getText
is documented as Protractor's API, I'm reporting it here.)
(FYI, originally, I hit this bug with Angular 2 and Protractor 2.5.0)