0

I need help in traversing the element to check whether a radio button is enabled or not.

Below is the sample structure looks like. I need to locate the radio button class which has text playwright.

<div class = "mainitem">
   <div class = "sideitem">
     <div class = "headeritem">
      <span class = "radiobutton"></span>
     </div>   
   </div>   
   <div class = "container">
      <span>playwright</span> 
   </div> 
</div>
stefan judis
  • 3,416
  • 14
  • 22
AKN
  • 21
  • 5
  • Have you tried writing some code? If not, please give it a go and share that attempt. – ggorlen Mar 15 '23 at 18:56
  • I tried page.locator(‘.mainitem’, {hasText=“playwright”}).locator(‘.radiobutton’) – AKN Mar 16 '23 at 10:17
  • Thanks. That code works fine for me after I use non-rich text quotes and correct object syntax: `page.locator(".mainitem", {hasText: "playwright"}).locator(".radiobutton")`. If this isn't working, can you provide a [mcve] please? – ggorlen Mar 16 '23 at 12:50

0 Answers0