簡體   English   中英

如何在stenciljs E2E測試中消除焦點

[英]How to remove focus in stenciljs E2E testing

在使用來自stenciljs的newE2EPage的端到端測試中,您可以在元素上調用focus()以將焦點設置在元素上:

   const page = await newE2EPage({html: `<my-component></my-component>`});
   const el = await page.find('my-component');
   await el.focus();

如何從元素上移開焦點?

PS我嘗試將重點放在第二個元素上,但這似乎不起作用。

PPS page.find()是如何在Stencil newE2EPage的E2EPage上執行querySelector的方法。 文檔位於: https : //stenciljs.com/docs/end-to-end-testing#find-an-element-in-the-shadow-dom

什么是page.find()方法?

嘗試通過單擊另一個元素來移動焦點。

await page.click(selector)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM