0

Could you help me how to write a code in python to click on the text "CORRETORA DE SEGUROS". They are inside a Shadow and I'm not getting an adequate result.

<ion-radio class="sc-ion-select-popover md in-item interactive radio-checked hydrated" aria-checked="true" aria-labelledby="ion-rb-1-lbl" role="radio" tabindex="0"></ion-radio>
   #shadow-root (open)
    <div class="radio-icon" part="container"><div class="radio-inner" part="mark"></div><div class="radio-ripple"></div></div>
    <label for="ion-rb-1"> CORRETORA DE SEGUROS </label>
    <input type="radio" tabindex="-1" id="ion-rb-1">

I've already tried in Python

shadow = navegador.execute_script('''return //ion-radio[@role="radio"]''')
shadow.find_element_by_css(".sc-ion-select-popover.md.in-item.interactive.hydrated")

I have this information by SelectorHubs maybe can help.

String cssSelectorForHost1 = ".sc-ion-select-popover.md.in-item.interactive.hydrated";
Thread.sleep(1000);
SearchContext shadow = driver.findElement(By.cssSelector(".sc-ion-select-popover.md.in-item.interactive.hydrated")).getShadowRoot();
Thread.sleep(1000);
shadow.findElement(By.cssSelector("label[for="ion-rb-2"]"));
Timus
  • 7,225
  • 5
  • 10
  • 24
Paulo
  • 1
  • 1
    Does this answer your question? [Does anybody know how to identify shadow dom web elements using selenium webdriver?](https://stackoverflow.com/questions/36141681/does-anybody-know-how-to-identify-shadow-dom-web-elements-using-selenium-webdriv) – Prophet Mar 25 '22 at 15:08

0 Answers0