Python Selenium访问多级HTML

2024-10-02 08:19:06 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使用pythonselenium模块访问多级html文件。示例html文件是:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#">
    <head>
        <body style="background: rgb(26, 26, 26)" class="remodal_lock remodal_active">
        <iframe id="ifrBmAuthApi" class="black-bg">
            <!DOCTYPE html>
            <html>
                <head>
                </head>
                <body>  
                <div class="ascendon">
                    <div id="accountManagementDiv" class="container-fluid">
                        <form id="SAMLPOST" method="POST">
                            <div class="validation-summary" cdvalidate="Email"></div>
                            <input id="Email-input" class="form-control stacked-input err" data-prop="Email" maxlength="50" required="" placeholder="Email" type="email">
                            </div>
                        </form>
                    </div>
                </div>
            </body>
        </html>
    </iframe>   
    </body>
</head>

我想访问内部的html文件id:“Email input”

我尝试以下场景直接访问 id="Email-input" and class="form-control stacked-input err" getting failed.

例如:打印driver.find_element_id(“电子邮件输入”)。是否显示()


Tags: 文件divformidhttpinputemailhtml

热门问题