标签名称茉莉花和量角器找不到的元素



我的以下测试总是失败,因为量角器无法通过标签名称找到元素。

it('should show test component',async () => {
await browser.get('/trade')
element(by.tagName(('test-component'))).isPresent()
.then(value=>{
console.log(value ,'first')
expect(value).toBeTruthy()
});
})

我已经在其他测试规范中尝试了相同的代码,但它有效。我在这里做错了什么?

尝试使用以下代码片段。

it('should show test component', async () => {
await browser.get('provide complete url');
var EC = browser.ExpectedConditions;
await browser.wait(EC.visibilityOf(element(by.tagName('test-component'))),10000);
element(by.tagName('test-component')).getText().then(async (value)=>{
console.log(value ,'first')
expect(await value).toBeTruthy();
});

最新更新