0
我在我的HTML下面的代码片段显示FB-连接链接:水豚+硒找不到FB-连接链路/按钮
<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>
即手动点击它时,工作正常。但是当在Cucumber中使用Capybara + Selenium(@javascript标签)时,他们似乎找不到该元素可以点击。我曾尝试多种组合试图与之相匹配的,如:
When I follow "mylogin" # or
When I press "mylogin"
我得到这样的答案:
no link with title, id or text 'mylogin' found (Capybara::ElementNotFound)
我也尝试了内部文本“登录”或“登录按钮”匹配,与徒劳无功。试图也按照3210的建议,但它没有奏效。
我使用Facebooker2宝石生成链接:
#in my index.html.haml
= fb_connect_async_js
= fb_login_and_redirect('http://localhost:3000/', id: 'mylogin')
宝石版本:
capybara (0.3.9) #(actually pulling it from github directly)
xpath (~> 0.1.2)
selenium-webdriver (>= 0.0.27)
cucumber (0.9.2)
任何提示?谢谢。
我也试图增加等待时间在几个方面,如“睡眠10”和“Capybara.default_wait_time = 10“。没有帮助。 – alp247 2010-10-12 15:45:40