Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automating website using DOM.
#1
Not Solved
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-

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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  allow HP products check box option automating vinni 0 1,999 07-23-2014, 11:12 AM
Last Post: vinni
  Automating Objective c++ Application QtpDoubts 2 4,434 05-23-2014, 04:34 PM
Last Post: excellentpawan123
  Automating Mozilla FireFox Browser Achuth 0 1,928 04-15-2014, 04:13 PM
Last Post: Achuth
  Automating JavaCanvas Object priyan 0 1,956 03-04-2014, 12:33 AM
Last Post: priyan
  automate a website which has flash objects. rohithaithal 0 1,624 12-02-2013, 03:05 PM
Last Post: rohithaithal

Forum Jump:


Users browsing this thread: 1 Guest(s)