Micro Focus QTP (UFT) Forums
The .Object method is not working on Firefox\Chrome.Is there any alternative to this - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: General (https://www.learnqtp.com/forums/Forum-General)
+--- Forum: Posting Guidelines/Disclaimer (https://www.learnqtp.com/forums/Forum-Posting-Guidelines-Disclaimer)
+--- Thread: The .Object method is not working on Firefox\Chrome.Is there any alternative to this (/Thread-The-Object-method-is-not-working-on-Firefox-Chrome-Is-there-any-alternative-to-this)



The .Object method is not working on Firefox\Chrome.Is there any alternative to this - kmandadi - 05-15-2014

Sad First of all, let's take a look on the version of the programs:

UFT: 11.53 build 0382 (Installed the UFT_000444)
Internet Explorer: 10.0.9200.16750
Firefox: 24.2.0

The problem: On IE we don't have any issue when we are working with web objects recognition and operation. On Firefox, we can recognize the objects and operate until certain point.

Follow a script sample and the description of the problem.
'-------------------------------------------------------
'Before run this script, open the browser on this url: http://www.w3schools.com/html/html_tables.asp (please go down and open Cell Padding-Try it yourself then you will get another browser opened)

Code:
Call TestBrowser(1,"Right")
MsgBox "TEST FINISHED!"
ExitTest
Sub TestBrowser(ColumnIndex,ExpectedAlignement)
Dim x

Dim strTextResult, strAlignment

Dim theTableObject, theCellRow
Dim theCell
Dim theCellStyle

strTextResult = ""

'Captured the object via XPath in order to make the execution independent of the browser (You can use creation time also)

Set objTable = Browser("Title:=.*").Page("Title:=.*").WebTable("xpath:=//h2[text()='HTML Table Example:']/../table[@cellpadding=3]")

If not objTable.Exist(0) Then
msgbox "Object doesn't exist."
else
intRowsNumber = objTable.RowCount

For x=0 To intRowsNumber -1

Set theTableObject=objTable.Object

'On Firefox the following error occurs on this line below: Type Error: obj[GetCaseInsensitiveName(...)].apply is not a function

Set theCellRow=theTableObject.rows(x)

Set theCell=theCellRow.Cells(ColumnIndex)

Set theCellStyle = theCell.currentStyle

strAlignment = theCellStyle.textAlign ''Get the align property of every cell

If UCASE(strAlignment) <> UCASE(strAlign) Then
strTextResult = strTextResult & "Row: " & x & ". Column: " & ColumnIndex & ". Expected: " & ExpectedAlignement & ". Found: " & strAlignment & ". " & vbcrlf
End If

Next

If strTextResult<>"" Then

msgbox strTextResult

End If

End If

End Sub