How can you store a value from one element in an Intern functional test that can be used to find additional elements?
For example, I have the following test snippet:
var mainItem = "Menu 1";
var subItem = "Sub Menu 1";
var mainItemId = "";
return this.remote
.elementByXPath("//*[contains(text(),'" + mainItem + "')]/ancestor::*[@dojoattachpoint='focusNode']")
.getAttribute("id")
.then(function(id){ mainItemId = id; })
.clickElement()
.end()
.wait(500)
.then(function(){ console.log(mainItemId); })
.elementByXPath("//*[contains(text(),'" + subItem + "')][ancestor::*[@dijitpopupparent='" + mainItemId + "']]")
.clickElement()
.end()
Basically, when I run the test, the mainItemId
value will log correctly, but the second elementByXPath
will not be found. If I initialize mainItemId
with the same value, the xpath works. Based on what I'm seeing, its as if mainItemId
will store the value only within the .then()
context.
Thanks.