htmliframeselenium-chromedrivergoogle-chrome-devtools

in Chrome devtools source tab, what is cd_iframe_id attribute?


My original HTML is

<iframe id="iframe1" src="iframe_over_shadow_test_child.html" title="Iframe Example"></iframe>

But I see it in Chrome devtools launched by chromedriver as

<iframe id="iframe1" src="iframe_over_shadow_test_child.html" title="Iframe Example" cd_frame_id_="854056df23f23b850b5103a5942e13de"></iframe>

I don't know what this cd_frame_id_ is ?

I searched internet. Only see it mentioned in another overstack post, in the answer part

I'd like to know

Thank you


Solution

  • At first I couldn't reproduce this, but later I searched on GitHub and found that it was related to Chrome.

    It's define-by-implement in ChromeDriver (cd) source tree. ChromeDriver use it to query subframe.

    If you use a browser that doesn't depends on ChromeDriver, it won't appear.

    You can also find some hard-coded things in element_util.cc, like:

    const char kElementKey[] = "ELEMENT";
    const char kElementKeyW3C[] = "element-6066-11e4-a52e-4f735466cecf";
    const char kShadowRootKey[] = "shadow-6066-11e4-a52e-4f735466cecf";