🔗 Parent Note
🤔 Situation
I have like this HTML and want to set a value into it.
<div class="bootstrap-dialog-message"> <input type="text" class="form-control"> </div>
😅 set finishes although it's not completed!
When capybara try to input the email,
find('input').set('loooooooooooooooooong@email.com')
the results were like this. it's kind of random error.
1: loooo 2: loooooooooooooooooong@email.com 3: loooooooooooooooooong@e . .
👍 Fix it!
Using Until
There is a method until ~ end
. You can try again until the condition will succeed.
until find('input') == 'loooooooooooooooooong@email.com' find('input').set('loooooooooooooooooong@email.com') end
Using 10.times
10.times do find('input').set('loooooooooooooooooong@email.com') break if find('input') == 'loooooooooooooooooong@email.com' end
Top comments (1)
In my case I was only able to write four characters and when I used larger strings I was getting the Selenium::WebDriver::Error::ElementNotInteractableError exception.