It looks like the Chromedriver and Firefoxdriver are not consistent with the value returned when setting a text field:
# Chrome
@b.text_field(:id, 'ZipCode').set '92130'
#=> ""
# Firefox
@b.text_field(:id, 'ZipCode').set '92130'
#=> nil
This is why your test fails for Firefox but not Chrome - ie a nil value will fail the assertion.
That said, I think the root problem is the way assert
is being used. It does not make sense to perform an assert on the any of these lines.
For example, the line:
assert @b.div(:class, 'modal-body')
Will always pass. The div
method always returns a Watir object, regardless of whether the element exists on the page. This means that the assert
will never fail.
You should remove the assert
for the lines you have shown. Then add an assert
to test a specific value.