0

我需要使用量角器脚本存储名字的值。用户登录时设置名字,它是登录用户的名称。如果可以使用by.addLocator().

下面是我的标签,它在 app-root 中设置。

app-root path="/" first-name="abc" last-name="def" is-admin="false"
4

1 回答 1

1

因为app-root是这里的标签,你可以尝试这样的事情

root_element = element(by.tagName('app-root'));
root_element.getAttribute('first-name').then((name)=>{
       var first_name  = name;
       //add an expectation to equal something that you're expecting.
       expect(name).to.equal(logged_in_user_name) 
});
于 2018-06-28T09:10:42.587 回答