Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading a file content which created by QTP
#1
Solved: 11 Years, 4 Months, 1 Week ago
Hi All,

I am facing one issue regarding reading a file, Can any one pls explain me to resolve the issue.

In my test I m copying some text from application, creating a file by command
Code:
"Set f1=fso.CreateTextFile("C:\test10.txt",ForWriting,True)"
and writing that captured text in that file "f1.write(stroutput)".

But Now I want read that file
Code:
Set f2 = fso.OpenTextFile("C:\test10.txt",ForReading,True)
msgbox f2.ReadAll

When I used above two statements i m getting a junk value as "ybT"
(Please see that attached snap for complete script and message box.)

Can I know is that any command to read the file content properly and avoid such junk messages.

Regards
Raj


Attached Files Image(s)
   
Reply
#2
Solved: 11 Years, 4 Months, 1 Week ago
Any update on this?
Regards
Raj
Reply
#3
Solved: 11 Years, 4 Months, 1 Week ago
Hi Rajashekar,

Just check with the below way :

Initallt add the browser,page,Webedit objects (Google Page) into OR properly.

Here i have used Opentextfile method(anyhow this method will creates the textfile implicitly)

Add the below code & execute .......

Code:
Dim fso,f,f1
Const ForReading = 1, ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, true)
Stroutput=browser("Google").Page("Google").WebEdit("q").GetROProperty("Value")
f.write(Stroutput)

set f1 = fso.OpenTextFile("c:\testfile.txt", ForReading,true)
msgbox f1.ReadAll


the above code is working fine.Smile


_____________________________________________________________
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading Global Sheet's DataTable Value Bhuvana 0 1,644 01-05-2020, 10:03 PM
Last Post: Bhuvana
  how to write the content obtained using the method GetPdfText Anisha 1 1,476 11-20-2017, 10:00 PM
Last Post: zunebuggy
  Reading Value from Java Table arjun.singh 8 24,433 10-11-2017, 02:51 PM
Last Post: sivaji
  Reading data from excel sheet serenediva 1 9,632 03-03-2017, 10:07 AM
Last Post: vinod123
  QTP not reading all properties ishan.mahajan@adp.com 2 2,513 05-04-2016, 10:50 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)