我当前正在尝试修复无处出现的Capybara错误。这导致我所有的测试失败。这些测试可以正常工作,我不确定发生了什么变化,因为错误意义不大
错误
Unable to find visible field "Username" that is not disabled (Capybara::ElementNotFound)
我从HTML获取的内容放在page.body和save_and_open_page
<div class="login-field">
<span><i class="fa fa-user fa-lg"></i></span>
<span><input autofocus="autofocus" placeholder="Username" type="text" name="user[username]" id="user_username"></span>
</div>
<div class="login-field">
<password-entry the-id="user_password" name="user[password]" placeholder="Password" show-lock="true"></password-entry>
</div>
测试本身
fill_in "Username", with: "username"
fill_in 'Password', with: "password"
click_button "Login"
我尝试进行查找并通过id查找。我认为错误一定更深,因为找不到元素,因为它显然正在渲染元素
答案 0 :(得分:0)
尝试使用:
find('css', visible: false).set("your text")