Dear Protractor Community,
Thank you for the support that I always get reading your posts.
I have the following problem:
I need to get string form this element:


This is the implementation for getting it:
var text = "";
this.getQR = function(){
var str1 = '{"qrCode": "';
var str2 = '"}';
var token = "eyJ0eXAiOiJKV1Ac7JKuZfB-ceUE"
var qrCode = "";
var qr = elem.qrCodeValue.getText().then(function(code) {
return code;
});
qr.then(function(text) {
qrCode = text
var code = str1.concat(qrCode, str2);
Implementation works fine and returns string for an element with hard coded string. But this one is dynamic and in this particular case I get empty string.
Locators used:
this.qrCodeValue = element(by.css(#qr-code-value'));
or
this.qrCodeValue = element(by.css('.qr-container div div div'));
What I鈥檓 doing wrong? Please advise me how I can get it. I need to use the qr code later to login to the web application via API call and now I鈥檓 stacked.
Thank you in advance.
Managed to find how to get it here:
https://stackoverflow.com/questions/25845938/protractor-gettext-returns-empty-string-for-non-empty-element
.getAttribute('textContent') works for me.
Closing this issue.
Most helpful comment
Managed to find how to get it here:
https://stackoverflow.com/questions/25845938/protractor-gettext-returns-empty-string-for-non-empty-element
.getAttribute('textContent') works for me.
Closing this issue.