views:

27

answers:

1

I have the following snippet in my html displaying a FB-Connect link:

<fb:login-button id="mylogin" onlogin="try {
window.location.href = "http://localhost:3000/";
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('window.location.href = \"http://localhost:3000/\";'); throw e }"></fb:login-button>

That works fine when manually clicking it. But when using Capybara+Selenium in Cucumber (@javascript tag), they don't seem to find the Element to click at all. I have tried several combinations trying to match it, like:

When I follow "mylogin" # or
When I press "mylogin"

And I get answers like:

no link with title, id or text 'mylogin' found (Capybara::ElementNotFound)

I also tried matching the inner text "Login" or "login-button", with no avail. Tried to follow the advice at http://stackoverflow.com/questions/3585533/cucumber-and-capybara-clicking-a-non-link-or-button-element too, but it didn't work.

I'm using the Facebooker2 gem to generate the link:

#in my index.html.haml
= fb_connect_async_js
= fb_login_and_redirect('http://localhost:3000/', id: 'mylogin')

Gem versions:

capybara (0.3.9) #(actually pulling it from github directly)
xpath (~> 0.1.2)
selenium-webdriver (>= 0.0.27)
cucumber (0.9.2)

Any hint? Thanks.

A: 

I'm experiencing the same thing but with different gems. I'm using Facebooker2 and get the same RJS error. I'm using Rails 3.01.

james