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 >> Micro Focus/Compuware TestPartner

Pages: 1
aka_Foamy
Newbie


Reged: 08/26/10
Posts: 3
Dynamic Attach Names
      #640162 - 08/26/10 08:33 AM

Hi all,

I've been working with TP for about a week now and hit a brick wall with a project regarding attach names.

The situation is that I have a web page that contains a number of check boxes and a delete button. I need to check specific check boxes and then click the delete button. The number of check boxes availible to check will change each time the script is run and each button has the same attach name with the only difference being a three digit number so check box one is "...101..." check box two is "...102..." (see below)

I know how to identify which boxes to check and how to attach to those boxes as well as how those attach names will change I just can't get a script together that allows me to chane the attach names dynamically.

Here's the relivent bits of code I currently have:

Dim attachTitle As String
Dim attachNo As String


attachNo = "103"

attachTitle = "Name=ctl00$ctl01$ctl00$ContentPlaceHolder1$ContentPlaceHolder1$ContentPlaceHolder1$wfIIP_1114$iipControl_Summary$rptrWorkSummary$ct" + attachNo + "$cmdDelete"

HTMLCheckBox(attachTitle).Click




The attachNo variable is just a stand in for testing purposes at the moment that will eventually be replaced by a number determined by an if loop.

My current experience is that trying to put a variable directly into an attach file doesn't work, neither does the code above.

I can't see the problem, hopefully someone here can help. Any question please ask


Post Extras: Print Post   Remind Me!   Notify Moderator  
tubaloth
Member


Reged: 02/13/07
Posts: 261
Re: Dynamic Attach Names [Re: aka_Foamy]
      #640202 - 08/26/10 03:44 PM

That code is pretty confusing.

But you can use a Variable in an attach, just not very easy.

Here is test partner Idenfying this Quick Reply box

HTMLTextArea("Name=Body").attach

If I wanted to use a varable with it I would do this


Dim attachName as String
attachName = "Body"

HTMLTextArea("Name=" & attachName).attach

That should work.

So in your case. I assume you need something else besides just
HTMLCheckBox(attachTitle).Click

What is the 103, is that an Index?

HTMLCheckBox("Index=" & attachTitle).Click

You should have an Index, but if not you can use the Element ID.

try that.


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


Reged: 08/26/10
Posts: 3
Re: Dynamic Attach Names [Re: tubaloth]
      #640334 - 08/27/10 09:33 AM

I'll try explaining it differently.

The identify tool gives me the following attach name:

HTMLButton("Name=BigBadWolf")

I want to be able to change the Bad in the middle, so I split it up like this.

Dim sectionOne As String
Dim sectionTwo As String
Dim sectionThree As String

sectionOne = Big
sectionTwo = Bad
sectionThree = Wolf

If I try attaching using HTMLButton("Name=BigBadWolf") everything works fine. I can't attach using the following though:

HTMLButton(sectionOne & sectionTwo & sectionThree)

The test results come back saying:

Failed to attach name:"Name=BigBadWolf"

does that make it any clearer?


Post Extras: Print Post   Remind Me!   Notify Moderator  
tubaloth
Member


Reged: 02/13/07
Posts: 261
Re: Dynamic Attach Names [Re: aka_Foamy]
      #640371 - 08/27/10 03:11 PM

HTMLButton("Name=" & sectionOne & sectionTwo & sectionThree)

Post Extras: Print Post   Remind Me!   Notify Moderator  
Spyder2000
Member


Reged: 01/28/09
Posts: 132
Re: Dynamic Attach Names [Re: tubaloth]
      #640876 - 09/02/10 05:03 AM

tubaloth has a good responce, but I wanted to make sure that you have everything. AKA you left out some quotes ('"'), thus:

Code:
   
Dim sectionOne As String
Dim sectionTwo As String
Dim sectionThree As String

sectionOne = "Big"
sectionTwo = "Bad"
sectionThree = "Wolf"

HTMLButton("Name=" & sectionOne & sectionTwo & sectionThree)



Good luck

--------------------
TestPartner:
Testing: TP 6.2 SP1 build 463, MS Access 2003
TP 6.0 SP1 build 476, SQL 2005 DB.
Test Environment:
Clients on VMWare XP Workstation
Run Clients useing VNC Ultra for Remote

Application Under Test:
IE 6 web apps
Using Test Partner Sence 2007
Using VBA Sence 1995
Other:
VB3 - VB6, VBScript, VB.NET 1 - 4, Learning C#, SQL server 2005 - 2008

Edited by Spyder2000 (09/02/10 05:04 AM)


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


Reged: 08/26/10
Posts: 3
Re: Dynamic Attach Names [Re: Spyder2000]
      #640987 - 09/03/10 12:43 AM

Thanks for the help guys, I've not been ignoring responses, it's just that our TP is down at the moment so havn't had the chance to try these suggestions.

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


Reged: 10/12/12
Posts: 1
Re: Dynamic Attach Names [Re: aka_Foamy]
      #717939 - 10/12/12 03:49 AM

Can anybody help me : I want to search a text and select the corresponding checkbox

Post Extras: Print Post   Remind Me!   Notify Moderator  
eggbox
Advanced Member


Reged: 01/27/02
Posts: 457
Loc: Detroit, Michigan
Re: Dynamic Attach Names [Re: jayshree4]
      #718027 - 10/15/12 09:01 AM

jayshree4, please create a new discussion topic, do not hijack existing ones.

Thank you

--------------------
//*eggbox


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



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

Moderator:  Myrtle, Jim Brennan, AJ, DSquared 

Print Topic

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

Rating:
Topic views: 5129

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5