最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

web scraping - NoDriver trying to access input inside IFrame - Stack Overflow

programmeradmin1浏览0评论

I'm trying to select an input field inside of an iframe but using nodrivers tab.select('input[name=number]') function its not working...

In the documentation it says nodriver has "smart lookup" which can find elements inside of iframes.

One of the my attempts was this: One of the my attempts was this:

        iframes = await tab.select_all("iframe")
        for frame in iframes:
            for attr in frame.attributes:
                if "test" in attr:
                    iframe = frame
        # Get required tab. Not safe in case when tab not found
        iframe_tab: uc.Tab = next(
            filter(
                lambda x: str(x.target.target_id) == str(iframe.frame_id), driver.targets
            )
        )
        # Fixing websocket url
        iframe_tab.websocket_url = iframe_tab.websocket_url.replace("iframe", "page")

however when using iframe_tab.get_content() it doesnt actually appear to have anything of use. is there a working method to access iframe content with nodriver?

发布评论

评论列表(0)

  1. 暂无评论