It is not possible to click on a link inside of a frame (Mac-Ruby-safariwatir)-Collection of common programming errors

I’m writing a test in Mac via Ruby 1.9.2-p136 using safariwatir 0.4.0

So, I have a link on the page

Add Content

which is located inside of the frame “main” and this frame is located inside of the other frame “content”

I need to click this link and go to another page, but I can’t because when I use

@browser.frame(:name,’content’).frame(:name,’main’).link(:text, ‘Add Content’).click

then the link is highlighted, but after that when ‘click method’ is called in safariwatir api I get the following error:

undefined method `is_frame?’ for nil:NilClass

If I use xpath like this:

@browser.frame(:name,’content’).frame(:name,’main’).link(:xpath, ‘//a[text()=”Add Content”]’).click

then the link is highlighted too, but nothing happens (there is no error, but an another page is not appeared)

this commands return

puts @browser.frame(:name,’content’).frame(:name,’main’).link(:xpath, ‘//a[text()=”Add Content”]’).exist? => true

puts @browser.frame(:name,’content’).frame(:name,’main’).link(:xpath, ‘//a[text()=”Add Content”]’).href => javascript:Dashboard.set(‘select-template-category’);document.forms[0].action=’/qa7/DashboardAdminAction.do’;document.forms[0].submit()

puts @browser.frame(:name,’content’).frame(:name,’main’).link(:xpath, ‘//a[text()=”Add Content”]’).title => Add more items to your dashboard

puts @browser.frame(:name,’content’).frame(:name,’main’).link(:xpath, ‘//a[text()=”Add Content”]’).text => Add Content

puts @browser.frame(:name,’content’).frame(:name,’main’).link(:xpath, ‘//a[text()=”Add Content”]’).html => Add Content

Could you explain me what is wrong or this is a bug of safariwatir ?

Thanks, Alexey

Originally posted 2013-11-19 13:19:02.