追加の要素を見つけるために使用できるインターン機能テストで、1 つの要素の値をどのように保存できますか?
たとえば、次のテスト スニペットがあります。
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()
基本的に、テストを実行すると、mainItemId
値は正しくログに記録されますが、2 番目elementByXPath
は見つかりません。同じ値で初期化mainItemId
すると、xpath が機能します。私が見ているものに基づいて、コンテキストmainItemId
内でのみ値を保存するかのようです。.then()
ありがとう。