Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

16634 Posts in 4352 Topics- by 28401 Members - Latest Member: 143myont
 

Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: problem in identifying the link    (Read 71 times)
vijay44
User
*
Online Online

Posts: 18


« on: February 08, 2010, 05:01:43 AM »

Hi,
I have 2 Links with process and processcomments
i have used the below code for identifying processcomments

Set WbLink = Description.Create()
WbLink("micclass").Value = "Link"
WbLink("name").Value = "C"
WbLink("href").Value=".*processComments.*"
Set AllWbLink  = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbLink)
         NumberOfLinks=AllWbLink.Count
         msgbox NumberOfLinks
         For i=0 to(NumberOfLinks)-1
if AllWbLink(i).GetRoproperty("href")<>"processComments.*"  then
AllWbLink(i).Click
End if
Next
Gives the exact result.
But now when i write for edit box:process
Set WbEdit = Description.Create()
      WbEdit("micclass").Value = "Link"
      WbEdit("name").Value = "C"
      wbEdit("href").Value="process.*"
      Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
      NumberOfEdits=AllWbEdit.Count
      msgbox NumberOfEdits
      For i=0 to(NumberOfEdits)-1
        if AllWbEdit(i).GetRoproperty("href")<>"process.*"  then
           AllWbEdit(i).Click
        End if
      Next

Now the problem is it matches with that of processcomments and clicks that too.
The href property of process is:javascript:Copy('process','0','2')
while the href property of processcomments is:
javascript:Copy('processComments','0','2')

I want to identify the process link with that of processcomments link
Any help will be really appreciated.
Regards;
Vijay


Logged
Asiq Ahamed
Moderator
Sr. User
*****
Offline Offline

Posts: 287



WWW
« Reply #1 on: February 08, 2010, 05:32:24 AM »

Hi Vijay,
      Use regular expression in your descriptive program. Instead of WbLink("href").Value=".*processComments.*", try WbLink("href").regularexpression= ".*processComments.*".

I hope this resolves your problem.
Logged
vijay44
User
*
Online Online

Posts: 18


« Reply #2 on: February 08, 2010, 05:49:00 AM »

The problem over here is identifying the process link.
I am fine with the processcomments link.
I does identify and clicks the right link.
Any help in identifying the process link will be really appreciated.

Regards;
Vijay
Logged
Asiq Ahamed
Moderator
Sr. User
*****
Offline Offline

Posts: 287



WWW
« Reply #3 on: February 08, 2010, 05:54:22 AM »

Hi Vijay,
     I meant to say that "Use regularexpression for both the links". And I have one question with the below code,

Set WbEdit = Description.Create()
WbEdit("micclass").Value = "Link"
WbEdit("name").Value = "C"
wbEdit("href").Value="process.*"'Is this link or webedit?
Logged
vijay44
User
*
Online Online

Posts: 18


« Reply #4 on: February 08, 2010, 06:13:16 AM »

Set WbLink = Description.Create()
         WbLink("micclass").Value = "Link"
         WbLink("name").Value = "c"
            WbLink("href").regularexpression= ".*processComments.*"

'               WbLink("href").Value= ".*process.*"
         Set AllWbLink  = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbLink)
         NumberOfLinks=AllWbLink.Count
         msgbox    NumberOfLinks

Both are links only, sorry for that.
I have tried this, it pops up error message type mismatch at regular expression.
Any help will be really appreciated
Regards;
vijay
Logged
Asiq Ahamed
Moderator
Sr. User
*****
Offline Offline

Posts: 287



WWW
« Reply #5 on: February 08, 2010, 07:02:07 AM »

Hi Vijay,
       Can you try by this way?
Code
GeSHi (qtp):
Set WbLink = Description.Create()



WbLink("micclass").Value = "Link"

WbLink("name").Value = "AdvancedQTP Forums"

WbLink("html tag").Value = "A"

WbLink("index").Value = 0

WbLink("href").regularexpression= True

WbLink("href").Value= ".*advancedqtp.com.*"





Browser("name:=QTP Codes").Page("title:=QTP Codes").Link(WbLink).Click



 
Created by GeSHI 1.0.7.20
Logged
vijay44
User
*
Online Online

Posts: 18


« Reply #6 on: February 08, 2010, 07:11:25 AM »

Hi,
WbLink("href").Value=".*processComments.*"
by filtering this it gives the exact value
wbLink("href").Value=".*process.*"
by filtering this it adds even the processcomments too.
The href value of process:javascript:Copy('process','0','2')
The href value of processcomments is:javascript:Copy('processComments','0','2')
The problem iam facing here is retrieving the exact child objects itself.
I have tried by using regular expression="True", the same result
Any help will be really appreciated.
Regards;
Vijay
Logged
Asiq Ahamed
Moderator
Sr. User
*****
Offline Offline

Posts: 287



WWW
« Reply #7 on: February 08, 2010, 07:15:20 AM »

Hi Vijay,
       Change the index value, it will work.

WbLink("index").Value = 0'processComments.*"
WbLink("index").Value = 1'process.*"
Logged
Pages: [1]   Go Up
Print
Jump to: