weixin_39679664
weixin_39679664
2020-12-08 18:38

fill_in() appends "undefinedundefinedundef..."

I have an empty form field (input[type=text]) and i want to set its value to "foo". But what actually gets filled in is "fooundefinedundefinedund...".

I am using the following steps:


find('#my_input_field').value
# ""

fill_in("my_input_field", :with => "foo")
# ""

find('#my_input_field').value
# "fooundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined"

The same works with selenium-webdriver without any problems. For me it looks like some javascript error due to the term "undefined". Maybe sth. with rails client side validations we are using.

However, maybe anyone is facing a similar issue?

Details about my setup (Gemfile.lock):


  GEM
    remote: http://rubygems.org/
    specs:
      actionmailer (3.1.0.rc5)
        actionpack (= 3.1.0.rc5)
        mail (~> 2.3.0)
      actionpack (3.1.0.rc5)
        activemodel (= 3.1.0.rc5)
        activesupport (= 3.1.0.rc5)
        builder (~> 3.0.0)
        erubis (~> 2.7.0)
        i18n (~> 0.6)
        rack (~> 1.3.1)
        rack-cache (~> 1.0.2)
        rack-mount (~> 0.8.1)
        rack-test (~> 0.6.0)
        sprockets (~> 2.0.0.beta.12)
      activemodel (3.1.0.rc5)
        activesupport (= 3.1.0.rc5)
        bcrypt-ruby (~> 2.1.4)
        builder (~> 3.0.0)
        i18n (~> 0.6)
      activerecord (3.1.0.rc5)
        activemodel (= 3.1.0.rc5)
        activesupport (= 3.1.0.rc5)
        arel (~> 2.1.4)
        tzinfo (~> 0.3.29)
      activeresource (3.1.0.rc5)
        activemodel (= 3.1.0.rc5)
        activesupport (= 3.1.0.rc5)
      activesupport (3.1.0.rc5)
        multi_json (~> 1.0)
      addressable (2.2.6)
      ansi (1.3.0)
      arel (2.1.4)
      bcrypt-ruby (2.1.4)
      bcrypt-ruby (2.1.4-java)
      bouncy-castle-java (1.5.0146.1)
      builder (3.0.0)
      capistrano (2.8.0)
        highline
        net-scp (>= 1.0.0)
        net-sftp (>= 2.0.0)
        net-ssh (>= 2.0.14)
        net-ssh-gateway (>= 1.1.0)
      capybara (1.0.0)
        mime-types (>= 1.16)
        nokogiri (>= 1.3.3)
        rack (>= 1.0.0)
        rack-test (>= 0.5.4)
        selenium-webdriver (~> 0.2.0)
        xpath (~> 0.1.4)
      capybara-webkit (0.6.0)
        capybara (~> 1.0.0)
      childprocess (0.2.0)
        ffi (~> 1.0.6)
      chunky_png (1.2.0)
      ci_reporter (1.6.5)
        builder (>= 2.1.2)
      client_side_validations (3.1.0)
      coffee-rails (3.1.0.rc.5)
        actionpack (~> 3.1.0.rc1)
        coffee-script (>= 2.2.0)
        railties (~> 3.1.0.rc1)
        sprockets (>= 2.0.0.beta.9)
      coffee-script (2.2.0)
        coffee-script-source
        execjs
      coffee-script-source (1.1.1)
      compass (0.11.5)
        chunky_png (~> 1.2)
        fssm (>= 0.2.7)
        sass (~> 3.1)
      crb (1.0.1)
      cucumber (1.0.2)
        builder (>= 2.1.2)
        diff-lcs (>= 1.1.2)
        gherkin (~> 2.4.5)
        json (>= 1.4.6)
        term-ansicolor (>= 1.0.5)
      cucumber-rails (1.0.2)
        capybara (>= 1.0.0)
        cucumber (~> 1.0.0)
        nokogiri (>= 1.4.6)
      diff-lcs (1.1.2)
      em-websocket (0.3.1)
        addressable (>= 2.1.1)
        eventmachine (>= 0.12.9)
      erubis (2.7.0)
      eventmachine (0.12.10)
      eventmachine (0.12.10-java)
      execjs (1.2.4)
        multi_json (~> 1.0)
      factory_girl (2.0.2)
      factory_girl_rails (1.1.0)
        factory_girl (~> 2.0.0)
        railties (>= 3.0.0)
      ffi (1.0.9)
      ffi (1.0.9-java)
      formtastic (2.0.0.rc3)
        rails (~> 3.0)
      fssm (0.2.7)
      gherkin (2.4.5)
        json (>= 1.4.6)
      gherkin (2.4.5-java)
        json (>= 1.4.6)
      growl (1.0.3)
      growl_notify (0.0.1)
        rb-appscript
      guard (0.5.1)
        thor (~> 0.14.6)
      guard-compass (0.0.6)
        compass (>= 0.10.5)
        guard (>= 0.2.1)
      guard-livereload (0.2.1)
        em-websocket (>= 0.2.0)
        guard (>= 0.4.0)
        json (>= 1.5.1)
      guard-rspec (0.4.0)
        guard (>= 0.4.0)
      haml (3.1.2)
      headless (0.1.0)
      highline (1.6.2)
      hike (1.2.0)
      i18n (0.6.0)
      jquery-rails (1.0.12)
        railties (~> 3.0)
        thor (~> 0.14)
      jruby-jars (1.6.3)
      jruby-openssl (0.7.4)
        bouncy-castle-java
      jruby-rack (1.0.9)
      json (1.5.3)
      json (1.5.3-java)
      json_pure (1.5.3)
      launchy (2.0.5)
        addressable (~> 2.2.6)
      mail (2.3.0)
        i18n (>= 0.4.0)
        mime-types (~> 1.16)
        treetop (~> 1.4.8)
      mime-types (1.16)
      multi_json (1.0.3)
      net-scp (1.0.4)
        net-ssh (>= 1.99.1)
      net-sftp (2.0.5)
        net-ssh (>= 2.0.9)
      net-ssh (2.1.4)
      net-ssh-gateway (1.1.0)
        net-ssh (>= 1.99.1)
      nokogiri (1.5.0)
      nokogiri (1.5.0-java)
      polyglot (0.3.2)
      rack (1.3.2)
      rack-cache (1.0.2)
        rack (>= 0.4)
      rack-mount (0.8.2)
        rack (>= 1.0.0)
      rack-ssl (1.3.2)
        rack
      rack-test (0.6.1)
        rack (>= 1.0)
      rails (3.1.0.rc5)
        actionmailer (= 3.1.0.rc5)
        actionpack (= 3.1.0.rc5)
        activerecord (= 3.1.0.rc5)
        activeresource (= 3.1.0.rc5)
        activesupport (= 3.1.0.rc5)
        bundler (~> 1.0)
        railties (= 3.1.0.rc5)
      rails31-evergreen (0.4.1)
        capybara (~> 1.0)
        coffee-script
        json_pure
        launchy
        sinatra (~> 1.1)
      railties (3.1.0.rc5)
        actionpack (= 3.1.0.rc5)
        activesupport (= 3.1.0.rc5)
        rack-ssl (~> 1.3.2)
        rake (>= 0.8.7)
        rdoc (~> 3.4)
        thor (~> 0.14.6)
      rake (0.8.7)
      rb-appscript (0.6.1)
      rb-fsevent (0.4.2)
      rdoc (3.9.2)
      rspec (2.6.0)
        rspec-core (~> 2.6.0)
        rspec-expectations (~> 2.6.0)
        rspec-mocks (~> 2.6.0)
      rspec-core (2.6.4)
      rspec-expectations (2.6.0)
        diff-lcs (~> 1.1.2)
      rspec-mocks (2.6.0)
      rspec-rails (2.6.1)
        actionpack (~> 3.0)
        activesupport (~> 3.0)
        railties (~> 3.0)
        rspec (~> 2.6.0)
      rubyzip (0.9.4)
      sass (3.1.7)
      sass-rails (3.1.0.rc.5)
        actionpack (~> 3.1.0.rc1)
        railties (~> 3.1.0.rc1)
        sass (>= 3.1.4)
        sprockets (>= 2.0.0.beta.9)
      selenium-webdriver (0.2.2)
        childprocess (>= 0.1.9)
        ffi (>= 1.0.7)
        json_pure
        rubyzip
      sinatra (1.2.6)
        rack (~> 1.1)
        tilt (>= 1.2.2, < 2.0)
      sprockets (2.0.0.beta.13)
        hike (~> 1.2)
        rack (~> 1.0)
        tilt (~> 1.1, != 1.3.0)
      term-ansicolor (1.0.6)
      therubyrhino (1.72.8)
      thor (0.14.6)
      tilt (1.3.2)
      treetop (1.4.10)
        polyglot
        polyglot (>= 0.3.1)
      turn (0.8.2)
        ansi (>= 1.2.2)
      tzinfo (0.3.29)
      uglifier (1.0.0)
        execjs (>= 0.3.0)
        multi_json (>= 1.0.2)
      warbler (1.3.1)
        jruby-jars (>= 1.4.0)
        jruby-rack (>= 1.0.0)
        rake (~> 0.8.7)
        rubyzip (>= 0.9.4)
      xpath (0.1.4)
        nokogiri (~> 1.3)

  PLATFORMS
    java
    ruby

  DEPENDENCIES
    capistrano
    capybara
    capybara-webkit
    ci_reporter
    client_side_validations
    coffee-rails (= 3.1.0.rc.5)
    compass
    crb
    cucumber-rails (~> 1.0.0)
    factory_girl_rails
    formtastic (= 2.0.0.rc3)
    growl
    growl_notify
    guard-compass
    guard-livereload
    guard-rspec
    haml
    headless
    jquery-rails
    jruby-openssl
    json
    launchy
    rails (= 3.1.0.rc5)
    rails31-evergreen
    rb-fsevent
    rspec-rails (~> 2.6.0)
    sass-rails (= 3.1.0.rc.5)
    therubyrhino
    turn
    uglifier
    warbler (= 1.3.1)

该提问来源于开源项目:thoughtbot/capybara-webkit

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39679664 weixin_39679664 4月前

    hm, i excluded all javascript from our page, but problem stays.. :/

    点赞 评论 复制链接分享
  • weixin_39907850 weixin_39907850 4月前

    Same issue here after upgrading webkit-capybara from 1.0.0.beta4 to 0.6.0. I'm on OSX 10.6 with Qt 4.7.2. Haven't tested with the latest Qt (4.7.3). Sticking with capybara-webkit 1.0.0.beta4 for now.

    点赞 评论 复制链接分享
  • weixin_39703468 weixin_39703468 4月前

    do the fields that you're having issues with have a maxlength attribute assigned?

    点赞 评论 复制链接分享
  • weixin_39703468 weixin_39703468 4月前

    I've cut version 0.6.1, which includes this fix. Thanks!

    点赞 评论 复制链接分享

相关推荐