Thanks Saumay.

I also wanted to capture the email id for the colleges. In case you is 
interested in the further code, pls check below. 

======================================================
systemutil.Run "Iexplore.exe" , 
"http://www.indiacollegesearch.com/mba/colleges-delhi-ncr";
wait 2 


Set o = description.Create
 o("micclass").value="Link"
 o("href").value="http://www\.indiacollegesearch\.com/college.*";

 Set Pg=Browser("title:=MBA Colleges in Delhi NCR.*").Page("title:=MBA 
Colleges in Delhi NCR.*")
Set icont = Pg.ChildObjects(o)

print  icont.count 
'Getting all the Links of the colleges from the webpage
    ReDim url(icont.count)

    For i = 0 to icont.count  - 1

    
        url(i) = icont(i).GetROProperty("url")
        
        print url(i)
    next 
    
systemutil.CloseProcessByName "Iexplore.exe"

'Inititalize and create a datatable sheet.
i =1
Datatable.SetCurrentRow i
Datatable.AddSheet("test").AddParameter "EmailID",""

'To click on the above collected links and find the email addtress.

zz = Ubound (url)
    ReDim email(zz)
    str = "http://www.indiacollegesearch.com/college-login.php";
    t = len (str)

   'For j = 0 to Ubound(url)
   For j = 0 to 4


   
        
               If Len(url(j)) > t Then
            email(j)= Findemail (url(j))
            print email(j)   
        
            ' This is to remove the Send email text 
            temp = Replace(email(j),"Send Email","")
        ' the collected  email id is written to the datatable as createxd 
above.
            Datatable.SetCurrentRow i
            Datatable.Value (1,3)=temp
            i=i+1
            
        
               End If

   Next
   ' Exporeting the Datatable to the excel sheet. 
Datatable.ExportSheet "C:\Users\satsingh\Desktop\Test4\Anand.xls","test"


Function Findemail  (u)
    systemutil.Run "Iexplore.exe" ,u
    Browser("title:=.*").Page("title:=.*").Sync
    Browser("title:=.*").Page("title:=.*").Link("name:=View Email").Click
    Findemail = Browser("title:=.*").Page("title:=.*").WebElement("html 
id:=CollegeEmail").GetROProperty("innertext")
    systemutil.CloseProcessByName "iexplore.exe"

End Function



























On Monday, August 5, 2013 6:12:44 PM UTC+5:30, Test wrote:
>
> Hi Satnam,
>
> Here is the code for getting the college names
>
> ''Creating an excel file
>
> Set ObjExcel=CreateObject("Excel.Application")
> ObjExcel.Visible=True
> ObjExcel.Workbooks.Add
>
> ''Creating the object Description
>
> Set ObjDesc = Description.Create()
> ObjDesc("micclass").Value = "WebElement"
> ObjDesc("class").Value = "college_name"
>
> Browser("MBA Colleges in Delhi").Highlight
> Set ObjElements = Browser("MBA Colleges in Delhi").Page("MBA Colleges in 
> Delhi").ChildObjects(ObjDesc)
>
> 'Getting the count of webelements
> varNoOfColl= ObjElements.Count
>
> ''Writing the names of colleges
> For intCollCnt=0 to varNoOfColl-1
>
> strCollNam= ObjElements(intCollCnt).GetROProperty("innertext")
>
> ObjExcel.Worksheets("Sheet1").Cells(intCollCnt+1,1)=strCollNam
>
> Next
>
> 'Saving the excel file
> ObjExcel.ActiveWorkbook.SaveAs "C:\Documents and Settings\"& 
> Environment.Value("UserName") &"\Desktop\List Of Colleges"
> ObjExcel.Quit
>
> Set ObjExcel=Nothing
>
>
> Thanks
> Saumya
>
> On Monday, July 29, 2013 12:21:20 AM UTC+5:30, Satnam Singh wrote:
>>
>> Hello All,
>>
>> Please see the url  
>> http://www.indiacollegesearch.com/mba/colleges-delhi-ncr
>>
>> This url lists various colleges. What I want to do is using QTP, read the 
>> college name and put it into an excel sheet.
>> Kindly help, as I am not sure how to proceed with this problem as the 
>> list is not under a webtable. 
>>
>

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to