Results 1 to 4 of 4
  1. #1

    Changing Web properties

    Changing Web properties

    The WebEdit and WebList properties change in my application after each build. I need to Capture these properties dynamically during the test run. We do not want to use class index or X and Y coordinates. Before Quick Test types in the text in the WebEdit field, I am trying to “Get” the properties of the webedit fields (from the application) and “set” them to the OR. So, I am using GetROProperty and SetTOProperty.

    For example: There are 2 text fields “field A” and “field B”

    Field A has the name property of “abc”
    Field B has the name property of “xyz”

    In the next build,

    Field A has the name property of “xyz”
    Field B has the name property of “def”

    I need to update the OR accordingly during the test run. I am trying to use the following code, but have been unsuccessful.

    MyVar=Browser("A:").Page("B:").WebEdit("fieldA").G etROProperty("Name")

    Browser("A:").Page("B:").WebEdit("fieldA:").SetTOP roperty "Name", MyVar


    Browser("A:").Page("B:").WebEdit("fieldA").Set DataTable("FirstName", dtGlobalSheet)

    YourVar=Browser("A:").Page("B:").WebEdit("fieldB:" ).GetROProperty("Name")

    Browser("A:").Page("B:").WebEdit("fieldB:").SetTOP roperty "Name", YourVar


    Browser("A:").Page("B:").WebEdit("fieldB").Set DataTable("Lastname", dtGlobalSheet)

    The Run Error is, “Cannot identify the object “fieldA” (of class WebEdit). Verify that this object’s properties match an object currently displayed in your application”

    How can I make Quick test identify the WebEdit fields ?


  2. #2
    Join Date
    Sep 2001
    Doncaster, UK

    Re: Changing Web properties

    Why can't you use the EditBox index, in these situations the index is sometimes the only way round your issue if regular expressions can't be used. You could use something like this:
    Browser("A:").Page("B:").WebEdit("index:=0").Set DataTable("FirstName")
    Browser("A:").Page("B:").WebEdit("index:=1").Set DataTable("LastName")

    2 alternatives:
    1) Ask dev to stop changing the edit box properties (If this is feasible)
    2) Get the new names, add them to constants and use that:

    Const oWebEditFname = "name:=xyz"
    Const oWebEditLname = "name:=abc"
    Browser("A:").Page("B:").WebEdit(oWebEditFname).Se t DataTable("FirstName")
    Browser("A:").Page("B:").WebEdit(oWebEditLname).Se t DataTable("LastName")

    Hope this helps, Mark Smith.

  3. #3

    Re: Changing Web properties

    Hi OnlyOne,
    One more solution:
    If I’ve understood you correctly:
    You need to select some value from WebList. And this value has to be as Name of WebEdit.
    Let’s do all that absolutely dynamically,
    without DataTable manipulations and dependency on Repository.
    Let’s get whatever you currently have in RunTime and Select it accordingly.
    So, it will be no need to remember values for next Run.
    Next time – it will be changes anyway. But your code will manage it – no matter what.

    ‘take value from WebEdit
    MyVar=Browser("A:").Page("B:").WebEdit("fieldA").G etROProperty("Name")
    ‘count WebListItems
    num = Browser("A:").Page("B:").WebList("u").GetROPropert y("items count")
    ’Select value of WebEdit from WebList in the loop, filtering WebListItems
    For i = 0 to (num - 1)
    ItemToFind = Browser("A:").Page("B:").WebList("u").GetItem (i)
    If ItemToFind = MyVar Then
    Browser(“A:”).Page("B:").WebList("u").Select "#" & I
    Exit For
    End if

    Hope it helps.

  4. #4

    Re: Changing Web properties

    Hi Mark, Thanks for the code. What I have done is, I have put the changing properties in the datatable and parameterized them (Set them to OR using SetToProperty)

    Browser("A:").Page("B:").WebEdit("C").SetTOPropert y "Name" ,DataTable.Value ("Value", "Action1")

    When I am using the above code, the OR is changing only during runtime. I need to change it permanently

    Is there anyway, that I can change the object properties in the Shared OR permanently using code instead of changing the OR dynamically during runtime (from datatable). Can you suggest me which methods can be used ?

    Also, in the datatable, I need QTP to pick the Values automatically corresponding to the name. For Example:

    Name Value
    ABC 1
    CDE 2
    EFG 3
    HIJ 4

    So, when the object name is EFG, I don’t want to use setcurrentrow(3)(Bcoz there are too many values in the datatable). Instead I need QTP to look for ‘EFG’ in the name field and pick the value ‘3’. Is this possible ?

    Thank You Very Much



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:23 PM.

Copyright BetaSoft Inc.