0

I tried verifying xpath in console i.e

$x("//input[contains(@data-bind,'selectedParentKpi')]")[0].value

o/p :- "12M Rolling MTBF (Days)"

So I am getting value in console. I am trying get data from my protractor test script as below

element(by.xpath("//input[contains(@data-bind,'selectedParentKpi')]")).getAttribute('value').then(function (text){
    console.log(text);
    cb();
})

IN test script I am getting null. Can anyone suggest what is the equavalent of $x("//input[contains(@data-bind,'selectedParentKpi')]")[0].value in protractor script

  • 1
    try `//input[@data-bind[contains(.,'selectedParentKpi')]]` as xpath – LMC Jul 22 '21 at 03:05
  • which chome and chromedriver you're using? 91? – Sergey Pleshakov Jul 22 '21 at 14:55
  • I am using chrome version -91. tried above xpath but still I am getting value as null. this input box gets data from javascript . But how can we read data using protractor – maheshwara ms Jul 23 '21 at 11:11
  • this question has been answered dozen of times in the last month. This behavior is a bug in chromedriver. There is a workaround described here https://stackoverflow.com/a/68075074/9150146 – Sergey Pleshakov Jul 23 '21 at 14:22

0 Answers0