setCheckbox problem need help...

View: New views
6 Messages — Rating Filter:   Alert me  

setCheckbox problem need help...

by dtops () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

in my xml-test writing i've come across this problem twice.  I'll try to describe it as clearly as possible...  

I have a main window, which, when clicked on, opens a new window on top.   The step I used to open this new window says the new window will "become the current one"   It didn't in the test,  but I used the
selectWindow step and the index="1" attribute to switch it over.  That part works fine...    I also used a verifyText step to be sure I'm in the correct window for my test.  

Now,  in this new window, which I have selected and verified,  there are some checkboxes.  I used the setCheckbox step and tried to use xpath to select one of them,  but I keep getting the message "the element with the xpath "" cannot be found.  

I really need to select these checkboxes for my test to be useful in any way,  so it can test the app like it was intended.   What do you recommend trying to get this done?    Thanks for reading and I look forward to your answers.  


Re: setCheckbox problem need help...

by Kelcy Monday-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From the error you're getting, sounds like you have an invalid (or null?) xpath.  If you need help with getting correct xpath, try this firefox extension: https://addons.mozilla.org/en-US/firefox/addon/1192

Also, it looks like you tried to attach part of the xml test, but I didn't receive that part of the message. In order to give further help, we'll need to see that.

Kelcy Monday


dtops <dtopley@...>
Sent by: webtest-admin@...

07/07/2009 10:39 AM
Please respond to
webtest@...

To
webtest@...
cc
Subject
[Webtest] setCheckbox problem need help...






in my xml-test writing i've come across this problem twice.  I'll try to
describe it as clearly as possible...  

I have a main window, which, when clicked on, opens a new window on top.  
The step I used to open this new window says the new window will "become the
current one"   It didn't in the test,  but I used the
selectWindow step and the index="1" attribute to switch it over.  That part
works fine...    I also used a verifyText step to be sure I'm in the correct
window for my test.  

Now,  in this new window, which I have selected and verified,  there are
some checkboxes.  I used the setCheckbox step and tried to use xpath to
select one of them,  but I keep getting the message "the element with the
xpath "" cannot be found.  

I really need to select these checkboxes for my test to be useful in any
way,  so it can test the app like it was intended.   What do you recommend
trying to get this done?    Thanks for reading and I look forward to your
answers.  

Here is a bit of my xml from the test... so you may be able to get a better
idea of what I'm dealing with from a different perspective.  



--
View this message in context:
http://www.nabble.com/setCheckbox-problem-need-help...-tp24296625p24296625.html
Sent from the WebTest mailing list archive at Nabble.com.

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest


Re: setCheckbox problem need help...

by dtops :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry about adding the xml.    Here's something new

I used firefox's webtest recorder sidebar and when it recorded the steps I took to fill the check box it recorded it as "<setSelectField>   even though it is not a SelectField, it is simply a Checkbox.   I got the x path by using firebug in firefox,  exploding the view of the page's source code,  and clicking through each div, td, tr,  etc.   I did this (in case you are wondering) because right clicking and "view in xpather" would not work on this window.   The firebug exploded view approach worked on a few other occasions to find a valid xpath,  but as valid as the xpath seems in this case,  Webtest cannot find it.  

no matter,  I've tried running the test with the setSelectField step instead of setCheckbox and still no change.   I agree, on paper it looks like the xpath is the issue,  but I have checked and re-checked it.  
Is there any other way to move through this step?  
Thanks so much.

and here is the actual part of the code that's giving me so much grief.

 <clickButton label="View Palette Colors"/>        <!--passed-->
    <verifyText text="3 items found"/>              <!--passed-->
    <setSelectField xpath="/html/body/div/div/table/tbody/tr/td[6]/input" text="fire"/>         <!--NO BUENO-->
    <clickElement description="add colors button" xpath="/html/body/div[@id='content']/div/h6/a/img"/>

Re: setCheckbox problem need help...

by Kelcy Monday-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

First off, a checkbox is a select element. That is why you can manipulate it with <select> functions.

Can you try it using another attribute of the checkbox element to identify it? (id attribute or name attribute).  That will tell is whether or not it's the xpath that is causing the problems.

Kelcy Monday


dtops <dtopley@...>
Sent by: webtest-admin@...

07/07/2009 01:10 PM
Please respond to
webtest@...

To
webtest@...
cc
Subject
Re: [Webtest] setCheckbox problem need help...






Sorry about adding the xml.    Here's something new

I used firefox's webtest recorder sidebar and when it recorded the steps I
took to fill the check box it recorded it as "<setSelectField>   even though
it is not a SelectField, it is simply a Checkbox.   I got the x path by
using firebug in firefox,  exploding the view of the page's source code,
and clicking through each div, td, tr,  etc.   I did this (in case you are
wondering) because right clicking and "view in xpather" would not work on
this window.   The firebug exploded view approach worked on a few other
occasions to find a valid xpath,  but as valid as the xpath seems in this
case,  Webtest cannot find it.  

no matter,  I've tried running the test with the setSelectField step instead
of setCheckbox and still no change.   I agree, on paper it looks like the
xpath is the issue,  but I have checked and re-checked it.  
Is there any other way to move through this step?  
Thanks so much.

and here is the actual part of the code that's giving me so much grief.

<clickButton label="View Palette Colors"/>        <!--passed-->
   <verifyText text="3 items found"/>              <!--passed-->
   <setSelectField xpath="/html/body/div/div/table/tbody/tr/td[6]/input"
text="fire"/>         <!--NO BUENO-->
   <clickElement description="add colors button"
xpath="/html/body/div[@id='content']/div/h6/a/img"/>
--
View this message in context:
http://www.nabble.com/setCheckbox-problem-need-help...-tp24296625p24377643.html
Sent from the WebTest mailing list archive at Nabble.com.

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest


Re: setCheckbox problem need help...

by dtops :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm having trouble with finding the id attribute,  but I'll try the name and let you know.  Thanks for the ideas!

Re: setCheckbox problem need help...

by John Spann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kelcy's right.  Your <setSelectField> line is the wrong step.  Also, the "text" attribute does not apply to a checkbox.

Please see the <setCheckbox> step: <http://webtest.canoo.com/webtest/manual/setCheckbox.html>

I'm assuming "fire" is the text that appears next to the checkbox, so the following line may not work.  You will need to look at what the value of the checkbox is in the html.

<setCheckbox xpath="/html/body/div/div/table/tbody/tr/td[6]/input" value="fire" />

Also, can you reference the checkbox in another way?  Your xpath is extremely rigid and will most likely require reworking if your webpage layout is modified.  Using the checkbox name would allow the HTML to change without breaking your test cases.

Cheers,

John Spann | Associate Software Engineer

Citrix Online Division
Citrix Systems, Inc.
6500 Hollister Avenue
Goleta, CA 93117 USA
www.citrix.com

Phone: 805.690.3489
Cell: 805.729.0008
Email: John.Spann@...


________________________________
From: Kelcy Monday <kmonday@...>
Reply-To: <webtest@...>, Kelcy Monday <kmonday@...>
Date: Tue, 7 Jul 2009 10:21:38 -0700
To: <webtest@...>
Subject: Re: [Webtest] setCheckbox problem need help...

First off, a checkbox is a select element. That is why you can manipulate it with <select> functions.

Can you try it using another attribute of the checkbox element to identify it? (id attribute or name attribute).  That will tell is whether or not it's the xpath that is causing the problems.

Kelcy Monday


dtops <dtopley@...>
Sent by: webtest-admin@... 07/07/2009 01:10 PM

Please respond to
webtest@...

To

webtest@...

cc
Subject

Re: [Webtest] setCheckbox problem need help...





Sorry about adding the xml.    Here's something new

I used firefox's webtest recorder sidebar and when it recorded the steps I
took to fill the check box it recorded it as "<setSelectField>   even though
it is not a SelectField, it is simply a Checkbox.   I got the x path by
using firebug in firefox,  exploding the view of the page's source code,
and clicking through each div, td, tr,  etc.   I did this (in case you are
wondering) because right clicking and "view in xpather" would not work on
this window.   The firebug exploded view approach worked on a few other
occasions to find a valid xpath,  but as valid as the xpath seems in this
case,  Webtest cannot find it.

no matter,  I've tried running the test with the setSelectField step instead
of setCheckbox and still no change.   I agree, on paper it looks like the
xpath is the issue,  but I have checked and re-checked it.
Is there any other way to move through this step?
Thanks so much.

and here is the actual part of the code that's giving me so much grief.

 <clickButton label="View Palette Colors"/>       <!--passed-->
    <verifyText text="3 items found"/>             <!--passed-->
    <setSelectField xpath="/html/body/div/div/table/tbody/tr/td[6]/input"
text="fire"/>         <!--NO BUENO-->
    <clickElement description="add colors button"
xpath="/html/body/div[@id='content']/div/h6/a/img"/>
--
View this message in context: http://www.nabble.com/setCheckbox-problem-need-help...-tp24296625p24377643.html <http://www.nabble.com/setCheckbox-problem-need-help...-tp24296625p24377643.html>
Sent from the WebTest mailing list archive at Nabble.com.

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest <http://lists.canoo.com/mailman/listinfo/webtest>


_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest