I'm on Ubuntu Linux/Firefox 13 and WATIR.
I have a Webpage that contains links to about 16 iframes.. all linked like 
this....
Clicking "11" will bring up an iframe that has both a name and id equal to 
"page_11"

     <a href="javascript:nextPage(8);">9</a>
     <a href="javascript:nextPage(9);">10</a>
     <a href="javascript:nextPage(10);">11</a>
     <a href="javascript:nextPage(11);">12</a>

Clicking the number will put the iframe into the page and on the page is 
another box for comments (main page)

Here's what I ** DO ** know because I have verified it by the script. The 
page will come up showing all 16 links. I have my WATIR script to click the 
11th link. It does that, it fills in the text boxes, it will then go back 
to the main page by using the browser.frame(:index,0).locate method and 
fill in the comments box which resides below the place where the iframes 
are filled in. 

None of this is a problem. 

The problem is trying to get the script to then click the link labeled 
"12". (It needs to go through these iframes sequentially)

It can't find the links on the main page again (or buttons for that 
matter). I end up with ....

    [remote server] 
file:///tmp/webdriver-profile20120730-32067-1haylz3/extensions/[email protected]/components/command_processor.js:5780:in
 
`unknown': Element is not currently visible and so may not be interacted 
with (Selenium::WebDriver::Error::ElementNotVisibleError)

 
My script (the relevant parts) are below....

    #!/usr/local/bin/ruby
    require 'rubygems'
    require 'watir-webdriver'
    require "webdriver-user-agent"
    require 'headless'
    require 'thread'
    
    #Firefox 13 path below. Doesn't work with 14
    Selenium::WebDriver::Firefox.path = 
'/home/janie/Downloads/firefox/firefox'
    
    profile = Selenium::WebDriver::Firefox::Profile.new
    profile.native_events = false;
    browser=Watir::Browser.new :firefox, :profile => profile

    browser.goto("http://myurl/test";)       
    browser.link(:text,"11").click
    browser.frame(:name,"page_11").locate
    puts "Text fields "
    puts browser.frame(:name,"page_11").text_fields.length
    
    $counter=0
    #This if loop works like a champ
    if browser.frame(:id,"page_11").text_fields.length > 0
       puts "Found and iterating through Text Boxes"
       while $counter < browser.frame(:id, "page_11").text_fields.length do
           browser.frame(:id, "page_11").text_field(:index, 
$counter).set("Robot_Test")
       end
    end
    
    #Now go back to the main page
    browser.frame(:index,0).locate
    
    #The below works too so I know I am back on the top level/parent
    if browser.text.include? "This is the main page"
      puts "--> Test Passed. Found the test string"
    else
      puts "--> Test Failed! Could not find:"
    end
    
    #Now we are back in the main page again
    browser.text_field(:name,"COMMENTS").set("ROBOT_TEST")
    #The above works great
    
    #And now the problem.....
    browser.link(:text,"12").click

Kaboom! I get the can't find element error above.

For some reason, it no longer sees the links on the main page or buttons. 
Any idea what could be causing this? I have been searching for this all day 
and this about the ONLY thing left before I can run this script everything 
else works great. 

Does anyone know how to get around this behavior in Watir?
Many thanks!

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to