What is DOM?
DOM – Document Object Model in QTP:
A platform and language independent standrad object model to represent HTML or XML and related formats.
DOM notation - .Object
By using DOM of the browser, the webpage can be accessed.
Examples:
Set img = Browser(“Browser”).Page(“Page”).WebTable(“Happy”).Object.all.tags(“img”)
msgbox img.length
For i=0 to img.length-1
msgbox img(i).src
Next
(OR)
Set font = Browser(“browser”).Page(“Page”).Webtable(“Happy”).Object.all.tags(“font”)
Msgbox font.length
For i = 0 to font.length-1
Msgbox font(1).color
Next
(Or)
Browser(“browser”).Page(“Page”).Object.Cookie
(Or)
Browser(“browser”).Page(“Page”).Object.Links
'Browser statusbartext:
sText = Browser("QTP - How to get Status").Object.StatusText
MsgBox sText
'Winstatusbar text:
sText = Browser("QTP - How to get Status").WinStatusBar("msctls_statusbar32").GetROProperty("text")
MsgBox sText
'Background color:
strColor = Browser("Certificate Error: Navigation").Page("Oracle BI Interactive").WebTable("BEA SNE Id").Object.rows(2).cells(16).currentStyle.backgroundColor
msgbox strColor
A platform and language independent standrad object model to represent HTML or XML and related formats.
DOM notation - .Object
By using DOM of the browser, the webpage can be accessed.
Examples:
Set img = Browser(“Browser”).Page(“Page”).WebTable(“Happy”).Object.all.tags(“img”)
msgbox img.length
For i=0 to img.length-1
msgbox img(i).src
Next
(OR)
Set font = Browser(“browser”).Page(“Page”).Webtable(“Happy”).Object.all.tags(“font”)
Msgbox font.length
For i = 0 to font.length-1
Msgbox font(1).color
Next
(Or)
Browser(“browser”).Page(“Page”).Object.Cookie
(Or)
Browser(“browser”).Page(“Page”).Object.Links
'Browser statusbartext:
sText = Browser("QTP - How to get Status").Object.StatusText
MsgBox sText
'Winstatusbar text:
sText = Browser("QTP - How to get Status").WinStatusBar("msctls_statusbar32").GetROProperty("text")
MsgBox sText
'Background color:
strColor = Browser("Certificate Error: Navigation").Page("Oracle BI Interactive").WebTable("BEA SNE Id").Object.rows(2).cells(16).currentStyle.backgroundColor
msgbox strColor
Comments
Post a Comment