12-07-2009, 06:59 AM
Hi Ankur,
I tried recording google.com via QTP but QTP is not able to recognize the objects so i decided to move on to DOM. I tried one script but its not working. kindly suggest what could be the possible reason for the error.
Below is the code-
In the Above set of codes, I am getting an error in
Set PageObject=IE.Document
as Unspecified error.
Kindly suggest. If you can provide more insight into DOM that would be great. I mean Why an object has to be changed to Document before it can be used for getElementsByNameTag property likewise what are the other DOM properties which we can use and on what all objects?
I tried recording google.com via QTP but QTP is not able to recognize the objects so i decided to move on to DOM. I tried one script but its not working. kindly suggest what could be the possible reason for the error.
Below is the code-
Code:
Dim IE
Dim PageObject
Dim Button
Dim ButtonObjects
Set IE=CreateObject("InternetExplorer.Application")
IE.Visible=True
IE.Navigate "http://google.com"
[color=#FF0000]Set PageObject=IE.Document[/color]
Set ButtonObjects=PageObject.getElementsByTagName("Input")
For each Button in ButtonObjects
if Button.name="btng" or Button.type="submit" then
if Button.value="Google Search" then
Button.Click
end if
Exit For
End if
Next
In the Above set of codes, I am getting an error in
Set PageObject=IE.Document
as Unspecified error.
Kindly suggest. If you can provide more insight into DOM that would be great. I mean Why an object has to be changed to Document before it can be used for getElementsByNameTag property likewise what are the other DOM properties which we can use and on what all objects?