51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2611|回复: 2
打印 上一主题 下一主题

[原创] qtp我遇到的三大问题,高手出招阿

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-7-6 19:11:40 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
javatable

2 javaTree

3 识别层次的问题

现象分别是

1.1 javatable,识别出这个控件后,有的调用setcelldata能设置单元格的值,有的设置不上,有的干脆提示说该操作不能执行,我没有办法只能用双击事件DblClick来获得焦点,然后用type方法输入

      还有getcelldata,有的返回该控件的java类路径,有的也能返回正确的值,如何解释?为什么同样识别出来的控件有的方法能用,有的不能用?

  1.2 javatable 中把某个单元格设置成ip地址格式 x.x.x.x ,我用同样的处理方法用双击事件DblClick来获得焦点,然后用type方法输入,这次有的问题,光标跑到输入区域的末尾了,ip头三个区域没有能输入进数值。如何解决?

2.1 javaTree 这个控件的主要问题是如果树的节点被设置成带checkbox,或者radiobutton的情况,识别的时候把checkbox或者radiobutton

     识别到跟javaTree一个层次,回放就出错。

3.1识别层次的问题, 控件中的控件

      像javaTree中节点为checkbox类型,识别的时候本来应该checkbox对象是javaTree的子对象,结果识别成一个同等层次,不能回放,

       这正常吗?是不是需要什么特别设置就能解决,  或者经过设置即使子父控件识别在同一个层次也能使用??

      识别出来的对象能否修改归属层次?用对象探测器只能识别到javaTree,不能识别到javaTree中的具体控件,有的即使是别出来的层次也不对

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2006-7-15 10:47:00 | 只看该作者

谢谢

我也在努力探索和咨询
回复 支持 反对

使用道具 举报

  • TA的每日心情
    开心
    2016-2-27 08:48
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
    发表于 2006-7-14 12:04:58 | 只看该作者

    一点帮助

    这也是我一直在关心的问题。先给你一点帮助,但愿对你有帮助:

    Problem ID: 34418

    --------------------------------------------------------------------------------
    Product:   QTP Version N/A    QTP 6.5     QTP 8.0
    Ext(s):   Java

    Topics:  
        Java Specific Questions or Problems
        Recognition and Interaction with Lists, Trees, and Comboboxes
    OS:   Any Windows Platform

    Creation Date:   22 Sep 2004
    Last Modified Date: 15 Dec 2004

    --------------------------------------------------------------------------------

    Problem Description: How to retrieve the index of a given element in a JavaTree

    Does QuickTest Professional have a method to retrieve the index of a given element in a JavaTree? The JavaTree method has a built-in method to retrieve the string from an index, but it does not appear to have a method to perform the reverse.

    --------------------------------------------------------------------------------

    Solution: Use the custom GetIndex function

    Note:
    This function is not part of QuickTest Professional. It is not guaranteed to work and is not supported by Mercury Customer Support. You are responsible for any and all modifications that may be required.

    This function was written against the JTree object in the SwingSet2 demo application that comes with the Sun JDK.

    GetIndex(obj, str1)

    obj The JTree object
    str1 The path to the element the generated index is for


    The index of an element in the JTree is dependent on how the tree is displayed. For example, if a branch containing three elements is expanded, the index for the desired element will be three greater than if that branch was collapsed. The GetIndex function collapses the tree to make sure the index returned is the same each time the function is executed.

    Public Function GetIndex(obj, str1)
    ' Collapse the tree
    rows = obj.GetROProperty("items count")
    For i = rows -1 to 0 step -1
    obj.object.collapseRow i
    Next

    ' Expand the specified row
    obj.Expand str1

    ' Get the number of items. Note: this value changes depending on how many branches in the tree are expanded.
    ' This is why the specified row must be expanded.
    rows = obj.GetROProperty("items count")

    ' Loop through the rows in the expanded tree to find specified item
    For i = 0 to rows -1
    item1 = obj.GetItem (CStr(i))

    match1 = StrComp(str1, item1)
    If match1=0 Then
    GetIndex = i
    Exit Function
    End If
    Next

    GetIndex = -1
    End Function

    RegisterUserFunc "JavaTree", "GetIndex", "GetIndex"

    msgbox JavaWindow("SwingSet").JavaTree("TreeDemo$1").GetIndex("Music;Jazz;Miles Davis;Voodoo Down")

    The RegisterUserFunc method registers the function for use with a QuickTest test object. For more information, please refer to Problem ID 25943 - How to register a user-defined function for use with objects.
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-26 06:51 , Processed in 0.067543 second(s), 29 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表