我参与了一个项目,其中包括登录到一个安全的网站,并通过点击页面内的元素下载一个文件,然后显示一个对话框,其中“确定”按钮必须单击以保存该框。我已经编写了所有相关的步骤,并单击生成“保存文件”对话框的按钮。在
我在windows7的64位机器上有Python-3.4.1 32位,使用的是mozillafirefox33。我尝试获取对话框的代码,它是:
{<1分$ <!DOCTYPE html>
<html id="ext-gen3" class=" ext-strict x-viewport" decorator="blank">
<head></head>
<body id="ext-gen4" class="ext-gecko3 cwc-view x-border-layout-ct" onload="cwc.getFrameworkWindow()">
<div id="cwc_header" class=" masthead x-border-panel" style="left: 0px; top: 0px; width: 1366px; height: 27px;"></div>
<div id="cwcNavPanel" class=" x-panel cwc-navPanel x-border-panel" style="width: 220px; left: 0px; top: 56px;"></div>
<div id="cwcCenterPanel" class=" x-tab-panel cwc-centerPanel x-border-panel" style="left: 228px; top: 35px; width: 1138px;"></div>
<!--Telephony Applet -->
<iframe id="ext-gen358" class="ext-shim" frameborder="0" src="/sm/js/9.33.4005/extjs/resources/images/default/s.gif" style="display: none; visibility: visible; z-index: 14998; left: 617px; top: 87px; width: 170px; height: 246px;"></iframe>
<div id="ext-comp-512057" class="x-tip" style="position: absolute; z-index: 20002; visibility: hidden; width: 74px; left: 672px; top: 89px; display: none;"></div>
<div id="cwcNavPanel-xsplit" class="x-layout-split x-layout-split-west x-unselectable x-splitbar-h" style="left: 220px; top: 56px; height: 351px;"></div>
<div id="ext-gen54" class=" x-unselectable x-splitbar-proxy x-splitbar-proxy-h"></div>
<div id="ext-gen359" style="position: absolute; left: -1000px; top: -1000px; visibility:…; text-transform: none; letter-spacing: normal; width: auto;"></div>
<div id="ext-gen76" class="x-shadow" style="z-index: 20000; left: 634px; top: 185px; width: 98px; height: 38px; display: none;"></div>
</body>
</html>
我如何捕捉弹出的警报框?在
我尝试过:
^{pr2}$但它总是给我一个例外,没有发现警报。如果出现的对话框是“iframe”怎么办。在
谢谢你的帮助!在
在尝试使用“警报”捕获对话框之前,我使用足够的时间(以秒为单位)等待对话框出现
使用切换到对话框后
driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
(我不确定它是否真的选择了对话框,我不知道如何选择它)
如何单击“确定”保存文件。我无法查看此对话框的源代码。在
谢谢!!在
如果需要在驱动程序中处理警报,可以检查:
^{pr2}$并通过“警报存在”状态
另外,如果警报需要一些时间,您可以在警报打开之前执行:
相关问题 更多 >
编程相关推荐