user2769463
user2769463

Reputation: 13

QTP Script - Click On WebTable Cell - Works in IE but not in Chrome

Writing automation script for a web application, there's a table,

Upon modification, user need to click on the cell to enable it.

  1. Before user click on any cell, there's no childitem is detect ( try with childitem count with micclass - webEdit, webList, webElement - All return 0)

  2. After user click on the cell, the cell will change to editable field - webedit/weblist -- at here the childitemcount become 1

  3. Hence, click on the cell become a core process ( Open for suggestion if there's any workaround)

Currently I am clicking on a cell, input then click on the next cell, then repeat again. Here are the fragment of my code. The Object.rows(row).cells(i).click is not working in Chrome, but IE is doing correctly without any Issue.

Tried:

Code:

row = 1  
rows = dictObject("WEBTBL_ACCDTL_FLOWTBL").GetROProperty("rows")
Arry_userInput = split(userinput,";")

'rows - 1 because of the header
If row <= rows-1 Then
    For i = 0 To Ubound(Arry_userInput) Step 1
        dictObject("WEBTBL_ACCDTL_FLOWTBL").highlight
        dictObject("WEBTBL_ACCDTL_FLOWTBL").Object.rows(row).cells(i).click 'Here Working in IE but not Chrome
        set currTxtBox = dictObject("WEBTBL_ACCDTL_FLOWTBL").ChildItem(row+1,i+1,"WebEdit",0)
        currTxtBox.Object.focus
        currTxtBox.Object.scrollIntoView    

        If i = 0 or i = 1 or i = 2 or i = 3 or i = 7 Then
            Call table_dropdown_set(currTxtBox,Arry_userInput(i))
        Else
            Call table_txtbox_set(currTxtBox,Arry_userInput(i))
        End If

        wait 1
    Next
    wait 1
    Msgbox "Input Process Done!"
Else 
    Msgbox "Please Trigger the button to add new row!"
End If

Upvotes: 1

Views: 880

Answers (1)

Motti
Motti

Reputation: 114695

I see you're using .Object in order to access the cell, by doing this you're not utilizing UFT's full capabilities. Have you tried using the Cell property? This was added in a recent version of UFT so you should check if it's available in the version you're using.

Usage:

Browser("B").Page("P").WebTable("WT").Cell(row, column).Click

Unlike the ChildItem function of WebTable the Cell returns the element of the cell itself and not the contents of the cell which I think is what you really need.

Upvotes: 2

Related Questions