The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
cyborgx_99
Newbie


Reged: 01/03/07
Posts: 4
Colon use in Descriptive Programming
      #447092 - 01/09/08 08:20 AM

Hi All,

I had a problem using descriptive programming to identify a group of radio buttons on a webpage today and accidentally found a solution to the problem which I dont quite understand.

The html for the radio buttons is as follows:

<input id="ctl00_JointApplicant_0" type="radio" name="ctl00_JointApplicant" value="00" class="radio" />
<input id="ctl00_JointApplicant_1" type="radio" name="ctl00_JointApplicant" value="01" class="radio" />


I tried all sorts of ways to identify the radio button group and click the radio button I wanted.

e.g
test = Browser("hwnd:=1508084").Page("micclass:=Page").WebRadioGroup("html id:=ctl00_JointApplicant_1").Exist
(Fail)

test = Browser("hwnd:=1508084").Page("micclass:=Page").WebRadioGroup("type:=radio","html id:=ctl00_JointApplicant_1").Exist
(Fail)

test = Browser("hwnd:=1508084").Page("micclass:=Page").WebRadioGroup("html tag:=INPUT","html id:=ctl00_JointApplicant_0").Exist
(Fail)

By accident I included an extra colon in the WebRadioGroup descriptive part and hey presto, the radio group is now recognised and allows me to click the radio button

test = Browser("hwnd:=1508084").Page("micclass:=Page").WebRadioGroup("html: id: =ctl00_JointApplicant_0").Exist
PASS

I'm not sure why or how this would work? Can anyone shed any light on this?

Thanks
Adnan


Post Extras: Print Post   Remind Me!   Notify Moderator  
Tarun LalwaniModerator
Veteran


Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
Re: Colon use in Descriptive Programming [Re: cyborgx_99]
      #447096 - 01/09/08 08:24 AM

Try using the name instead of html id

....WebRadioGroup("name:=ctl00_JointApplicant").Exist(0)

--------------------
Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **

KnowledgeInbox RSS


Post Extras: Print Post   Remind Me!   Notify Moderator  
Turbografx
Super Member


Reged: 10/21/05
Posts: 1756
Loc: London, U.K
Re: Colon use in Descriptive Programming [Re: Tarun Lalwani]
      #447099 - 01/09/08 08:29 AM

I think your original ones may as failed as the underscores need to be escaped. (i.e \_)

Post Extras: Print Post   Remind Me!   Notify Moderator  
cyborgx_99
Newbie


Reged: 01/03/07
Posts: 4
Re: Colon use in Descriptive Programming [Re: Turbografx]
      #447397 - 01/10/08 02:26 AM

Hi Tarun,

I've tried the name and pretty much everything that could be viewed in the object spy with no luck

Turbografx, i'll give your method a try and see what happens.

Thanks


Post Extras: Print Post   Remind Me!   Notify Moderator  
cyborgx_99
Newbie


Reged: 01/03/07
Posts: 4
Re: Colon use in Descriptive Programming [Re: cyborgx_99]
      #447495 - 01/10/08 06:18 AM

I've tried the backslash before the '_', it treats the backslash as part of the string.

I've got the opposite happening now!

HTML:
<input id="ctl00_rb_Nationality_0" type="radio" name="ctl00_rb_Nationality" value="German" class="radio" />
<input id="ctl00_rb_Nationality_1" type="radio" name="ctl00_rb_Nationality" value="Other" class="radio" />

Now using the above:
test = Browser("hwnd:=1508084").Page("micclass:=Page").WebRadioGroup("html: id: =ctl00_rb_Nationality_0").Exist
(Fail)
but
test = Browser("hwnd:=1508084").Page("micclass:=Page").WebRadioGroup("html id: =ctl00_rb_Nationality_0").Exist
Pass (I've removed the extra colon now)

The only difference is, the radio buttons 'value' was a number before and now it's a string.


Post Extras: Print Post   Remind Me!   Notify Moderator  
chillyhouse
Active Member


Reged: 06/20/04
Posts: 960
Loc: Miami,FL
Re: Colon use in Descriptive Programming [Re: cyborgx_99]
      #447509 - 01/10/08 06:46 AM

try the below code:
If Browser("micClass:=Browser").Page("micClass:=Page").WebRadioGroup("html id:=ctl00\_rb\_Nationality\_0","name:=ctl00\_JointApplicant").Exist(2) Then
msgbox "it works"
Else
msgbox "it doesnt work"
End If

you have to spy on the radio button and make sure you have "ctl00_rb_Nationality_0" for html id and "ctl00_JointApplicant" for name.

--------------------
"I realize it's an error, but no one is going to try to do that!"
From "Top 10 Stupid Comments from Developers".


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 88 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 1525

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5