如何使用 playwright 根据其他类的文本选择元素

问题描述 投票:0回答:1

我需要帮助来遍历元素以检查单选按钮是否已启用。

下面是示例结构。我需要找到具有文本剧作家的单选按钮类。

<div class = "mainitem">
   <div class = "sideitem">
     <div class = "headeritem">
      <span class = "radiobutton"></span>
     </div>   
   </div>   
   <div class = "container">
      <span>playwright</span> 
   </div> 
</div>
typescript automation playwright playwright-python playwright-test
1个回答
0
投票

page.locator('.container > span')

这应该有效

© www.soinside.com 2019 - 2024. All rights reserved.