如何用capybara填充文本字段:在轨道中使用selenium

时间:2013-11-07 11:34:44

标签: ruby-on-rails selenium capybara

如何用capybara填充文本字段:在rails中使用selenium?

我有这样的代码:

it 'anonymous upload', :js => true do
    visit '/'
    page.find("#upload-bill-anonymous").click
    path = DATA_TEST+SUCCESS
    attach_file("bill", path)
    page.find("div#submitbutton.wizard-1").click
    fill_in 'user_email', :with => "test@local.com"
    page.find("div#submitbutton.wizard-2").click
    page.find("#link-resend").click
  end

使用selenium fill_in我得到这样的错误 “失败/错误:fill_in'user_email',:with =>'test@local.com'  硒::的webdriver ::错误:: ElementNotVisibleError:“

1 个答案:

答案 0 :(得分:0)

user_email是id?如果是的话应该有效。你也可以尝试:

page.find(:css, "#user_email").set("test@local.com")