getAttribute is dropping characters under a certain condition
Environment:
- Angular 2 RC1
- Protractor 3.2.2
While performing a myEl.getAttribute('href'), I noticed that a character was being dropped from the result. Unfortunately, I am unsure how to provide code for reproduction. Here is my specific case.
The resulting html from the angular2RC1 is as follows:
<a target="_blank" href="http://http://mysite.com/">http://mysite.com/</a>
Yes, I know the href is in error above, I've logged that ticket to my dev team. However, performing a getAttribute on that element:
$('a').getAttribute('href').then(function(text) { console.log("link href = " + text); });
results in the following (notice the missing colon in the second http://):
link href = http://http//mysite.com/
I am noticing this in elementExplorer as well.
I've discovered a way to reproduce the issue. Use the quickstart guide as the base. Modify app/app.component.ts to be:
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<a href="http://http://www.google.com">http://www.google.com</a>'
})
export class AppComponent { }
Run the server locally,
Then using elementExplorer protractor --elementExplorer
type $('a').getAttribute('href') and note the result.
Also, try the following spec test spec.js
'use strict';
describe('Protractor Demo App', function() {
it('should test hyperlink\'s href attribute', function() {
browser.get('http://localhost:3000');
expect(element(by.css('a')).getText()).toEqual('http://http://www.google.com');
});
});
Thanks for the repro steps! I just did this with Protractor 4.0.3 and Angular 2-rc5, and am not able to reproduce the problem. I'm willing to bet this was fixed either with recent changes to webdriver or Angular 2 - both have been under a lot of flux recently.