51Testing软件测试论坛

标题: 用web_reg_find设置了中文检查点,已转码了,回放时能找到,但是count=0求大神指点 [打印本页]

作者: 远方的小企鹅    时间: 2015-11-19 16:23
标题: 用web_reg_find设置了中文检查点,已转码了,回放时能找到,但是count=0求大神指点
web_add_cookie("cna=4vNJDlAYFTwCAbeDAMm/GgD6; DOMAIN=z1.cnzz.com");

        web_add_cookie("cna=4vNJDlAYFTwCAbeDAMm/GgD6; DOMAIN=c.cnzz.com");

   
    lr_convert_string_encoding( "在线作业",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"str" );
               
   lr_save_string(lr_eval_string("{str}"),"a");
               
        web_reg_find("Text={a},"
                                 "Search=ALL",
                     "SaveCount=Count",
                LAST);
        
        web_url("www.zuihuixue.com",
                "URL=http://www.zuihuixue.com/",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                LAST);


Action.c(23): Notify: Saving Parameter "str = 鍦ㄧ嚎浣滀笟\x00".
Action.c(25): Notify: Parameter Substitution: parameter "str" =  "鍦ㄧ嚎浣滀笟\x00"
Action.c(25): Notify: Saving Parameter "a = 鍦ㄧ嚎浣滀笟".
Action.c(27): Notify: Parameter Substitution: parameter "a" =  "鍦ㄧ嚎浣滀笟"
Action.c(27): Registering web_reg_find was successful          [MsgId: MMSG-26390]

Action.c(32): Found resource "http://img.zuihuixue.com/clearn/assets/img/icons/medal.svg" in HTML "http://www.zuihuixue.com/"          [MsgId: MMSG-26659]
Action.c(32): Registered web_reg_find successful for "Text=鍦ㄧ嚎浣滀笟,Search=ALL"          [MsgId: MMSG-26362]
Action.c(32): Notify: Saving Parameter "Count = 0".
Action.c(32): web_url("www.zuihuixue.com") was successful, 298529 body bytes, 4514 header bytes, 371 chunking overhead bytes          [MsgId: MMSG-26385]
Action.c(44): Notify: Transaction "登录" started.

作者: fairylly    时间: 2015-11-20 09:17
        web_reg_find("Text={a},"
                                 "Search=ALL",

=》

        web_reg_find("Text={a}",
                                 "Search=ALL",
逗号放错位置了
作者: 远方的小企鹅    时间: 2015-11-20 12:04
fairylly 发表于 2015-11-20 09:17
web_reg_find("Text={a},"
                                 "Search=ALL",

嗯嗯是的,我改过了,可是还是找不到唉
作者: 远方的小企鹅    时间: 2015-11-20 15:08
求高手指点啊
作者: 远方的小企鹅    时间: 2015-11-23 14:28
问题已解决
作者: fairylly    时间: 2015-11-23 17:29
你的代码我试过,改了逗号位置就可以找到的啊
作者: 远方的小企鹅    时间: 2015-11-24 14:21
fairylly 发表于 2015-11-23 17:29
你的代码我试过,改了逗号位置就可以找到的啊

你是这完全复制这段脚本吗?
作者: fairylly    时间: 2015-11-27 09:50
远方的小企鹅 发表于 2015-11-24 14:21
你是这完全复制这段脚本吗?

是的,直接复制这段代码,修改逗号位置后,就找到了
Action.c(17): Notify: Saving Parameter "Count = 1".
作者: 远方的小企鹅    时间: 2015-11-27 10:49
fairylly 发表于 2015-11-27 09:50
是的,直接复制这段代码,修改逗号位置后,就找到了
Action.c(17): Notify: Saving Parameter "Count =  ...

啊,为什么我的还不行  就是找不到
作者: 远方的小企鹅    时间: 2015-11-27 11:16
fairylly 发表于 2015-11-27 09:50
是的,直接复制这段代码,修改逗号位置后,就找到了
Action.c(17): Notify: Saving Parameter "Count =  ...

我又试了下,这次可以找到,我设置了下,现在是已经把中文的转为UTF-8了,那运行时设置里面的convert to/from -utf'_8就要选择NO了,这样是可以回放成功。如果还是Yes的话,试了几次都不成功

和这个有关系吗?



作者: fairylly    时间: 2015-11-27 15:46
远方的小企鹅 发表于 2015-11-27 11:16
我又试了下,这次可以找到,我设置了下,现在是已经把中文的转为UTF-8了,那运行时设置里面的convert to/ ...

用你的代码,运行时设置里面的convert to/from utf-8,要设置为NO,因为你做了转换:
lr_convert_string_encoding( "在线作业",LR_ENC_SYSTEM_LOCALE,LR_ENC_UTF8,"str" );

如果运行时设置里面的convert to/from utf-8,你设置为YES,不用转换,直接下面这样就行了:
        web_reg_find("Text=在线作业",
                     "Search=ALL",
                     "SaveCount=Count",
                LAST);
        
        web_url("www.zuihuixue.com",
                "URL=http://www.zuihuixue.com/",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                LAST);



作者: msnshow    时间: 2015-11-28 18:00
主要还是编码不一致,引起乱码了,所以会找不到
作者: 远方的小企鹅    时间: 2015-11-30 09:43
fairylly 发表于 2015-11-27 15:46
用你的代码,运行时设置里面的convert to/from utf-8,要设置为NO,因为你做了转换:
lr_convert_strin ...

是的,现在明白了,哈哈,谢谢你




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2