【发布时间】:2016-10-28 19:27:09
【问题描述】:
如何使用 python selenium 模块访问多级 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 file-id : "Email-input"
我尝试以下场景直接访问 id="Email-input" 和 class="form-control stack-input err" 失败。
例如: >>> print driver.find_element_by_id("Email-input").is_displayed()
错误
【问题讨论】:
标签: python selenium selenium-webdriver