• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 開源功能測試工具WATIR 中文問題處理

    發表于:2009-03-11來源:作者:點擊數: 標簽:工具開源WATIRwatirWatir
    WATIR 中文問題處理 WATIR是個不錯的 自動化測試 工具,但對中文的支援有些問題,可以透過下面方式修改.仿間還有另一個叫Waitcr-cn的解法,但是測試後並不能用我目前使用的版本是WATIR-1.5.3, 不同版本應該有類似的改法 Step 1.修改\lib\ ruby \gems\1.8\gems\
    WATIR 中文問題處理   WATIR是個不錯的自動化測試工具,但對中文的支援有些問題,可以透過下面方式修改.仿間還有另一個叫Waitcr-cn的解法,但是測試後並不能用我目前使用的版本是WATIR-1.5.3, 不同版本應該有類似的改法   Step 1.修改\lib\ruby\gems\1.8\gems\watir-1.5.3\watir\input_elements.rb class TextField中新增一個method,程式如下:    def characters_in(value)
            index = 0
            while index < value.length
             len = value[index] > 128 ? 2 : 1
             yield value[index, len]
             index += len
            end
        end Step 2.同一個檔案修改Method doKeyPress 為   def doKeyPress(value)
          value = limit_to_maxlength(value)
          characters_in(value) { |c|
            sleep @container.typingspeed
            @o.value = @o.value.to_s + c  
            @o.fireEvent("onKeyDown")
            @o.fireEvent("onKeyPress")
            @o.fireEvent("onKeyUp")
          }
        end   原先的程式碼先Mark 或直接取代   接下來即可測試 # the Watir controller
    require "watir"
    # set a variable
    test_site = "http://www.google.com" # open the IE browser
    ie = Watir::IE.new # print some comments
    puts "Beginning of test: Google search." puts " Step 1: go to the test site: " + test_site
    ie.goto test_site puts " Step 2: enter '跳樓大拍賣' in the search text field."
    ie.text_field(:name, 'q').set('跳樓大拍賣') # "q" is the name of the search field  不會又是只抓中文第一個字的前半個Byte啦

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>