selenium定位不到弹出对话框

SLAM11111111111 2015-03-17 09:59:51
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div style="width: 1600px; height: 761px; display: block;" id="div_wrapper">
<iframe id="ifream_dialog" src="" style="background:#bcbcbc; position:absolute; width:100%; height:100%; z-index:-1; display: block;" frameborder="0"> </iframe>
</div>
<div style="left: 550px; top: 274px; display: block;" class="dialog">
<div class="dialog_top"></div>
<div class="dialog_content">
<div class="dialog_header"> <span class="dialog_header_left">注意</span> <span class="dialog_header_right"><a tabindex="-1" href="javascript:void(0);" title="" id="psw_close_btn"><img src="warning_files/dialog_close_btn.png" title="" alt=""></a></span> </div>
<div class="dialog_table">密码强度低,为了避免登录安全问题,请修改密码。</div>
<div class="dialog_table">
<input tabindex="-1" id="check_pass_remind" type="checkbox">
<span> 不要提醒</span></div>
<div class="dialog_table_bottom">
<div class="dialog_table_r"> <span class="button_wrapper pop_confirm" id="psw_confirm"> <span class="button_left"> <span class="button_right"> <span class="button_center"><a tabindex="-1" href="javascript:void(0);" title="">确认</a></span> </span></span></span>    <span class="button_wrapper" id="psw_Cancel"> <span class="button_left"> <span class="button_right"> <span class="button_center"><a tabindex="-1" href="javascript:void(0);" title="">取消 </a></span> </span></span></span> </div>
</div>
</div>
<div class="dialog_bottom"></div>
</div>







我可以定位到上面的iframe 但是定位不到下面的dialog。求指点。


...全文
15380 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_39334736 2017-07-08
  • 打赏
  • 举报
回复
selenium切换弹出框遇到问题,就大神帮忙 如图,页面出现的弹出框是div实现的,不知道怎么去实现输入,查看页面元素没有ifram,很尴尬,也是同一个Title。 如果不切换到弹出框,输入框
绝绝子heyyeah 2016-08-27
  • 打赏
  • 举报
回复
有解决方案吗?
jimao1985 2016-07-01
  • 打赏
  • 举报
回复
哈哈,刚刚搞定这个问题了,看下面截图

代码显示弹出窗口与那个mainFrame是同一层窗口,同时我知道mianframe在顶层窗口下面,所以这里我通过browser.switch_to_default_content()语句返回到顶层窗口,然后在用browser.find_element_by_xpath语句定位我想要查找的页面元素
这样就找到了
jimao1985 2016-07-01
  • 打赏
  • 举报
回复
我现在也碰到同样的问题,这个弹出框是用div模拟出来的,用switch_to_window和switch_to_frame都切换不过去

5,006

社区成员

发帖
与我相关
我的任务
社区描述
解读Web 标准、分析和讨论实际问题、推动网络标准化发展和跨浏览器开发进程,解决各种兼容性问题。
社区管理员
  • 跨浏览器开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧