Learn how to handle iframe which are inside shadow dom in selenium | Complex automation scenario

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024
  • Take my Udemy Course and learn A to Z with deep concepts about XPath, cssSelector, WebElements, Shadow DOM, iframes, SVG, SelectorsHub, TestCase Studio and more complex automation scenarios to be an automation expert-
    www.udemy.com/...
    Or
    Join my training to be expert in XPath, Selectors, WebElement, DOM, SelectorsHub & TestCase Studio. Registration Link-
    selectorshub.c...
    One to one support-
    selectorshub.c...
    SelectorsHub home page & download link-
    selectorshub.com/
    Buy beautiful SelectorsHub T-Shirt from here-
    teeshopper.in/...
    Donate & support SelectorsHub-
    selectorshub.c...
    SelectorsHub Telegram Group-
    t.me/joinchat/...
    Need support, connect on Slack
    bit.ly/SH_Slack
    SelectorsHub Udemy Course-
    bit.ly/SH_Full_...
    Detailed tutorial on iframe & nested iframe-
    • How to Handle iFrame a...
    Detailed tutorial on Shadow DOM-
    • SelectorsHub: How to A...
    If SelectorsHub blocked in company then how to get it unblocked-
    • What permissions Selec...
    ▬▬▬▬▬▬ TH-cam Playlists 🚀 ▬▬▬▬▬▬
    SelectorsHub Tutorial ► bit.ly/SH_tutor...
    XPath Tutorial Tutorial ► bit.ly/XPath_Tu...
    CSS Selectors Tutorial ► bit.ly/cssSelec...
    ▬▬▬▬▬▬ SelectorsHub Sponsor 👋 ▬▬▬▬▬▬
    TestProject ► bit.ly/Sh_TestP...
    ▬▬▬▬▬▬ Follow SelectorsHub 👋 ▬▬▬▬▬▬
    Don't forget to subscribe ► bit.ly/Selector...
    TWITTER ► / selectorshub
    LINKEDIN ► / selectorshub
    Join Slack ► bit.ly/SH_Slack
    ▬▬▬▬▬▬ Connect with me 👋 ▬▬▬▬▬▬
    Don't forget to subscribe ► bit.ly/Selector...
    TWITTER ► / sanjaykumaarr
    LINKEDIN ► / chropath-creator
    #shadowdom #iframe #selenium

ความคิดเห็น • 13

  • @tulasiramsunkara
    @tulasiramsunkara 2 ปีที่แล้ว +1

    Excellent. Not faced this scenario till today.

    • @SelectorsHub
      @SelectorsHub  2 ปีที่แล้ว +1

      Now you will see such scenarios a lot in future as many companies are implementing shadow dom

  • @ramakant135
    @ramakant135 8 หลายเดือนก่อน

    I am getting staleElementReferenceException

  • @ShreekanthKoraboina
    @ShreekanthKoraboina 3 หลายเดือนก่อน

    Thank You Sanjay!

  • @uuuuuuuuuuuuu8379
    @uuuuuuuuuuuuu8379 2 ปีที่แล้ว

    I have a situation where i need to scroll inside a to get its contents to load. Any ideas how to do that?

  • @piyushkotiyal9964
    @piyushkotiyal9964 2 ปีที่แล้ว +1

    bro i am doing the same for but code i copied gives undefined method error(method getShadowRoot() is undefined for type WebElement ) :
    String cssSelectorForHost1 = "body > hapana-widget:nth-child(17) > div:nth-child(2)";

    SearchContext shadow = driver.findElement(By.cssSelector("body > hapana-widget:nth-child(17) > div:nth-child(2)")).getShadowRoot();// here error comes
    Thread.sleep(1000);
    shadow.findElement(By.cssSelector("#hosted_page_add_card"));

    • @SelectorsHub
      @SelectorsHub  2 ปีที่แล้ว

      Make sure you are using selenium 4. Please watch this video to understand the concept- th-cam.com/video/IbjHhi7hcpI/w-d-xo.html

    • @Jamato-sUn
      @Jamato-sUn ปีที่แล้ว

      Try getting shadow root using a script and a query.
      shadow_host = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'shreddit-experience-tree')))
      script = """return arguments[0].shadowRoot.querySelector('accountmanager-').shadowRoot"""
      inner_shadow = driver.execute_script(script, shadow_host)

    • @ankithm1927
      @ankithm1927 9 หลายเดือนก่อน

      How to handle element which is sitting inside a which is within shadow root and these two is within a
      Basically -shadow root- - element

  • @mv8167
    @mv8167 ปีที่แล้ว

    I purchased the Selectors Hub Pro version. But when inside an or shadow-root, the notification just indicates xPath/Css... I can see that the web page has both and shadow-root, But SHP is not. What might I need to do for better results?

    • @SelectorsHub
      @SelectorsHub  ปีที่แล้ว

      Could you please connect with us on live chat at the website, we need more details to tell you the reason. We will have to see the DOM to tell the exact reason.

  • @amritapriyadarshini511
    @amritapriyadarshini511 ปีที่แล้ว

    Hi Snjay,Facing one difficulities .I am expecting help from you .When I copied the code for the element which is there in shadowdom ,I am getting this type of code from selectorhub
    //This Element is inside single shadow DOM.
    String cssSelectorForHost1 = "macroponent-f51912f4c700201072b211d4d8c26010[component-id='qlktjnr']";
    Thread.sleep(1000);
    SearchContext shadow = driver.findElement(By.cssSelector("macroponent-f51912f4c700201072b211d4d8c26010[component-id='qlktjnr']")).getShadowRoot();
    Thread.sleep(1000);
    shadow.findElement(By.cssSelector("#gsft_main"));
    ===================================================
    But when I have watched your video for you it is showing different code without searchcontext
    please let me know what is wrong i am doing

    • @prasadprocks
      @prasadprocks ปีที่แล้ว

      Hello Amrit, did you get any success over this issue?