Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the problem with this code? Pls reply ASAP
#1
Not Solved
Hi All,

Can anyone answer this question please?

I am trying to capture the Privacy policy of Google and store in a Text file.

I have written the following code.

Code:
If browser("Google").Page("Google").Image("Google").Exist Then
    reporter.ReportEvent micDone, "google page", "google page is found"
    else
    reporter.ReportEvent micDone, "google page", "google page not found. Exiting"
    ExitAction()
End If
If browser("Google").Page("Google").Link("Privacy").Exist Then
    reporter.ReportEvent micDone, "Google privacy", "google privacy link found"
    else
    reporter.ReportEvent micDone, "google privacy", "google privacy link not found.Exiting"
    ExitAction()
End If
If browser("Google").Page("Google").Link("Privacy").Exist Then
    browser("Google").Page("Google").Link("Privacy").Click()
End If
If browser("Google").Page("Privacy Center").Link("Privacy Policy").Exist Then
    reporter.ReportEvent micDone, "Privacy center", "Privacy center page found"
    else
    reporter.ReportEvent micDone, "Privacy center", "privacy center page not found. Exiting"
    ExitAction()
End If
If browser("Google").Page("Privacy Center").Link("Privacy Policy").Exist Then
    browser("Google").Page("Privacy Center").Link("Privacy Policy").Click()
End If

If browser("Google").Page("Privacy Policy – Google").WebButton("Search").Exist Then
    reporter.ReportEvent micDone,"Privacy policy", "you are in the right page"
    else
    reporter.ReportEvent micDone,"Privacy policy", "You are in the wrong page"
End If
Dim str
If browser("Google").Page("Privacy Policy – Google").WebButton("Search").Exist Then
    str=browser("Google").Page("Privacy Policy – Google").GetROProperty("innertext")
  
End If
Dim fso, File1, File2
Set objFSO=CreateObject("Scripting.FileSystemObject")
objFile1=FSO.CreateTextFile("C:\testfile.txt", true)

Const ForWriting=2
Set objFSO=CreateObject("Scripting.FileSystemObject")
objFile2=FSO.OpenTextFile("C:\testfile.txt", ForWriting, True)

objFile1.write str

All the lines are executed successfully till it reaches CreateTextFile line.

Please let me know what did I miss in the above code?

Earliest reply is highly appreciated!
Thanks,
Kishore
Reply


Messages In This Thread
What is the problem with this code? Pls reply ASAP - by kkishore12345 - 12-09-2008, 11:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to solve / record SAP (Transaction code PA40) Infotypes sequence problem in QTP kamal262007 0 2,199 02-04-2013, 11:25 AM
Last Post: kamal262007
  systemUtil.run script is not generating while recording in qtp 9.5..pls help me senthil.kumar 0 2,499 01-24-2013, 01:22 PM
Last Post: senthil.kumar
  QTP gets crashed on start up or on save a script. Pls advise pandeche 2 3,302 04-16-2012, 12:14 PM
Last Post: leema
  Please suggest some books to learn VBScript basics for qtp. Pls share if u have any. GSuba 0 3,942 04-08-2011, 12:55 AM
Last Post: GSuba
  Does any has .ISO file/package for QTP 9.0 or QTP 10 or QTP 11 ..Email pls? amipraj1 1 3,466 04-06-2011, 09:52 AM
Last Post: manishbhalshankar

Forum Jump:


Users browsing this thread: 1 Guest(s)