在watir-webdriver 0.6.6中从iFrame中访问元素失败-在0.6.4中可以正常工作 [英] Accessing elements from within a iFrame -fails in watir-webdriver 0.6.6 - works fine in 0.6.4

查看:69
本文介绍了在watir-webdriver 0.6.6中从iFrame中访问元素失败-在0.6.4中可以正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在iFrame内部的下拉菜单中选择一个值.框架嵌套在表格中. HTML:

I am trying to select a value in a dropdown which is inside a iFrame. The frame is nested within a table. HTML:

<html class ="some text"> 
<head>...</head> <body id="htmlBody"> 
 <div class= "modalWindow ui-dialog-content ui-widget-content ModalWindow containsFrame" id="ui-id-2"> 
   <iframe src= "/MyApplicantPortal/Applicant/254471/SelectOrderTemplate?t=1"> 
   #document 
    <html class = "some text" 
     <head id= "Head1"> 
     <body id="htmlBody"> 
     <form method= "post" action="SelectOrderTemplate?t=1" id="form1"> 
      <div class = "ModalContent"> 
       <Table> 
        <td class="label1"> 
         <Select id= "MyselList" </td>

我的代码:

element(:select_frame, :frame, :src => MyApplicantPortal\/Applicant\/\d+\/SelectOrderTemplate\?t=1/)
select_list(:template) {select_frame_element.select_list_element(:id => 'MyselList')}

错误: Watir::Exception::UnknownFrameException: unable to locate frame using {:src=>/MyApplicantPortal\/Applicant\/\d+\/SelectOrderTemplate\?t=1/, :tag_name=>"frame"}

推荐答案

Watir-webdriver 0.6.5更改了定位框架的工作方式.

Watir-webdriver 0.6.5 has changed the way locating frames works.

  • 在(即0.6.5之前)之前,browser.frame位于frameiframe元素.
  • 现在,browser.frame会找到frame元素,而browser.iframe会找到iframe元素.
  • Before (ie pre-0.6.5), browser.frame located frame and iframe elements.
  • Now, browser.frame locates frame elements and browser.iframe locates iframe elements.

您将需要更改框架访问器以匹配新规则(迁移到0.6.5或更高版本时).第二个参数需要从:frame更改为:iframe:

You will need to change your frame accessor to match the new rules (when you migrated to 0.6.5 or later). The second parameter needs to change from :frame to :iframe:

element(:select_frame, :iframe, :src => /MyApplicantPortal\/Applicant\/\d+\/SelectOrderTemplate\?t=1/)

这篇关于在watir-webdriver 0.6.6中从iFrame中访问元素失败-在0.6.4中可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆