Reputation: 13
Writing automation script for a web application, there's a table,
Upon modification, user need to click on the cell to enable it.
Before user click on any cell, there's no childitem is detect ( try with childitem count with micclass - webEdit, webList, webElement - All return 0)
After user click on the cell, the cell will change to editable field - webedit/weblist -- at here the childitemcount become 1
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:
Highlight the table - It's showing the correct table
Print row, i
after highlighted the table
IE -- it will be 1,0 ; 1,1 ; 1,2 and so on
Chrome -- it's failed at the first step, Error = General Run Error
Change Value of row, i to be +1 both ( still not working )
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
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