Search code examples
qtphp-uft

Object required: UFT


Can't get any further on here. I am in a situation where I've to select a webcheckbox depending on index. Below is my code

Set Brw = Browser("title:=.*").Page("title:=.*")

MilestoneTBLRow=brw.webtable("cols:=7","column names:=;Milestone Name;Milestone Date;Description;Created Time;Modified Time;Action").RowCount

MilestoneTBLCol=Brw.webtable("cols:=7","column names:=;Milestone Name;Milestone Date;Description;Created Time;Modified Time;Action").ColumnCount(1)

For i = 2 To MilestoneTBLRow  Step 1
    set MilestoneTBL = Browser("title:=.*").Page("title:=.*").webtable("cols:=7","column names:=;Milestone Name;Milestone Date;Description;Created Time;Modified Time;Action")
    `MilestoneTBL.childitem(i,1,"WebCheckBox",0).set "ON"
    Browser("title:=.*").Page("title:=.*").WebButton("name:=Mass Edit","type:=button","html tag:=INPUT","index:=0").click
    btnSave "0"
Next

The error happens at Object required: 'MilestoneTBL.childitem(...).
From a webtable, I need to select the webcheckbox depending upon there index.In this case, the index starts at index "0" & it is in 2nd row of webtable. The row number & index doesn't match here. If the index is 0 then the row is 2. I need to supply a variable which will keep increasing index by 1. I've tried using MilestoneTBLRow out here MilestoneTBL.childitem(i,1,"WebCheckBox",MilestoneTBLRow).set "ON" & that returns an error Object required: 'MilestoneTBL.childitem(...).

Could you please correct me out here?


Solution

  • Create a one temporary variable and increment that variable in 'for' loop something like this

    temp=0
    *Set Brw = Browser("title:=.*").Page("title:=.*")
    MilestoneTBLRow=brw.webtable("cols:=7","column names:=;Milestone           Name;Milestone Date;Description;Created Time;Modified Time;Action").RowCount
    MilestoneTBLCol=Brw.webtable("cols:=7","column names:=;Milestone Name;Milestone Date;Description;Created Time;Modified Time;Action").ColumnCount(1)
    For i = 2 To MilestoneTBLRow  Step 1
    set MilestoneTBL =   Browser("title:=.*").Page("title:=.*").webtable("cols:=7","column  names:=;Milestone Name;Milestone Date;Description;Created Time;Modified Time;Action")
    `MilestoneTBL.childitem(i,1,"WebCheckBox",temp).set "ON"
     Browser("title:=.*").Page("title:=.*").WebButton("name:=Mass Edit","type:=button","html tag:=INPUT","index:=0").click
    btnSave "0"
    temp=temp+1
    Next