0

I want to retrieve the value for our version which is stored in HTML DOM.

enter image description here

Using node.js and protractor. I don't know how to go about it.

Please provide your valuable knowledge for the same :)

I want the value 2016.R08.1.RC1

HDJEMAI
  • 9,436
  • 46
  • 67
  • 93
Jatin
  • 660
  • 3
  • 8
  • 28

2 Answers2

4

The simplest way is to select html by selector and get manifest property:

element(by.css('html')).getAttribute('manifest');

Then you should receive the full value of manifest property.

G07cha
  • 4,009
  • 2
  • 22
  • 39
  • Hi Konstantin, I use your advice and get following error : Stack: TypeError: Cannot assign to read only property 'stack' of Error while waitin g for Protractor to sync with the page: "window.angular is undefined. This coul d be either because this is a non-angular page or because your test involves cli ent-side navigation, which can interfere with Protractor's bootstrapping. See h ttp://git.io/v4gXM for details" – Jatin Aug 29 '16 at 06:50
  • Can you know why is this happening? – Jatin Aug 29 '16 at 06:51
  • As error message clearly says, you're probably running Protractor on non-angular page. If so, use [Webdriver](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs) instead. – G07cha Aug 29 '16 at 07:41
1

I've just come through this question and it's answer while doing protractor e2e angular 5/6 tests.

The answer from @Konstantin Azizov is good but element(by.css('html')).getAttribute('manifest') will return a promise not the value itself indicated by it's API:

So you can do something like:

element(by.css('html')).getAttribute('manifest').then((data) => {
  elementHtmlValue = data;
});

The content then of elementHtmlValue is what you are looking for :)

HDJEMAI
  • 9,436
  • 46
  • 67
  • 93