Poll: The .Object method is not working on Firefox\Chrome. I would like to know if anybody has an alternative to this in order to get the same script working on both browsers.
You do not have permission to vote in this poll.
Difficult
0%
0 0%
Easy
0%
0 0%
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The .Object method is not working on Firefox\Chrome.Is there any alternative to this
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to get current style formats in Chrome Koteswara Rao 2 2,712 01-17-2020, 12:47 AM
Last Post: ratnakar.e
  How to disable automatic chrome updates for chrome 30, WIn7 maruthiyadav 2 3,304 02-26-2014, 12:34 PM
Last Post: maruthiyadav

Forum Jump:


Users browsing this thread: 1 Guest(s)