2012-12-11 2 views
0

이메일 본문을 테스트하고 싶습니다.I 프레임에 중첩 된 요소는 어떻게 찾습니까?

FCK 편집기를 사용하여 3 개의 i- 프레임 깊이가 있습니다.

<...name="fancybox-frame"...> 
    <iframe> 
     <iframe> 
      <body>H E R E I S W H A T I W A N T T O A C C E S S</body> 
     </iframe> 
    </iframe> 
</[fancybox-frame]> 

모호성과 재미를 제외하고는 프레임 내에서 여러 번 어떻게 사용합니까?

내가 이것을 사용하는 경우 ...

within_frame('fancybox-frame') do 
fill_in('frm_subject', :with => eventname + ' email') 
within_frame('iframe[id="frm_message___Frame"]') do 
    within_frame('iframe') do 
    fill_in('body', :with => 'Event email for ' + now.to_s) 
    end 
end 

끝 나는이 얻을

...

 switchFrame execution failed; 
    INVALID_EXPRESSION_ERR: DOM XPath Exception 51 (Selenium::WebDriver::Erro 
r::WebDriverError) 
    ./features/step_definitions/RCST08_steps.rb:96:in `block (2 levels) in <to 
p (required)>' 
    ./features/step_definitions/RCST08_steps.rb:94:in `/^select a message to s 
end\.$/' 
    features\RCST08.feature:26:in `And select a message to send.' 

어떤 아이디어가?

+0

중첩 된 iframe ID가 있습니까? 그렇다면 전환하여 조치를 취하십시오. – Amey

답변

0

"전환"할 때까지 셀레늄은 프레임 (<IFRAME> 또는 < 프레임 >) 내부의 내용을 처리 할 수 ​​없습니다. Ruby 바인딩에서 그게 within_frame(...) do ... end입니다. 당신은 당신이되고 싶은 곳 밖의 한 프레임처럼 보입니다. 다음과 같은 내용이 필요합니다.

within_frame('fancybox-frame') do 
    fill_in('frm_subject', :with => eventname + ' email') 
    within_frame('iframe[id="frm_message___Frame"]') do 
    within_frame('...name of outer iframe...') do 
     within_frame('...name of inner iframe...') do 
     fill_in('body', :with => 'Event email for ' + now.to_s) 
     end 
    end 
    end 
end 
관련 문제