Skip to content

Nested calls to element.query_selector(selector) fail #3533

Closed
@julesmcrt

Description

@julesmcrt

I can't figure out why, but element.query_selector(selector) seems to only work the first time I call it.
Here is an example on https://www.dezlearn.com/nested-iframes-example/

from seleniumbase import Driver

driver = Driver(uc=True)
driver.uc_activate_cdp_mode("https://www.dezlearn.com/nested-iframes-example/")
driver.sleep(5)

iframe1 = driver.cdp.find_element("iframe#parent_iframe") # this works
print(type(iframe1))
# type(iframe1) is <class 'seleniumbase.undetected.cdp_driver.element.Element'>

iframe2 = iframe1.query_selector("iframe#iframe1") # this works
print(type(iframe2))
# type(iframe2) is <class 'seleniumbase.undetected.cdp_driver.element.Element'>

button = iframe2.query_selector("button#u_5_6") # this doesn't work, but doesn't output any error message either
print(type(button))
# type(button) is <class 'NoneType'>

Can you replicate this? I'm on SeleniumBase version 4.34.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP Modeworkaround existsYou can reach your destination if you do this...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions