1

我正在尝试在 iFrame 内的下拉列表中选择一个值。框架嵌套在表格中。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"}

4

2 回答 2

3

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

  • 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.

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/)
于 2014-02-03T21:40:15.657 回答
0

我正在发布一个新版本的页面对象 gem 来解决这个问题。应该一两天就出来了。

于 2014-02-04T10:59:21.450 回答