Solved

Remove ticked checkboxes test automation java CSS

Posted on 2014-04-16
7
228 Views
Last Modified: 2014-09-15
I am doing test automation and have a problem with writing a function removing checked/ticked tick boxes.

I have three tickboxes and in this test automation function I want to remove all three ticks and what makes it complicated is that I only want to click in the tickboxes if they are already ticked to remove the ticks.

There is a tag showing if the box is ticked:

<input type="checkbox" name="companyPopularNames[0].reservationOnline" checked="checked" class="info">
<span>Online/Mobile</span>

<input type="checkbox" name="companyPopularNames[0].reservationPrint" class="info">
<span>Print</span>

<input type="checkbox" name="companyPopularNames[0].reservationVoice" checked="checked" class="info">
<span>Voice</span>

In the example above 2 of 3 tick boxes are ticked. Online/Mobile and Voice tick boxes are ticked because checked="checked". So I need to be able to determine which tick boxes are ticked and only click on those tick boxes in this function. The end result of the function should always be that all tick boxes are removed no matter of how many tick boxes are ticked from the beginning!
0
Comment
Question by:Bear2
  • 3
  • 2
7 Comments
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
ID: 40005816
http://jsbin.com/sebevedi/1/edit

function uncheck() {
    
$("input:checked").prop("checked",false);
}

Open in new window

0
 

Author Comment

by:Bear2
ID: 40014315
I'm getting this error message:


java: cannot find symbol
  symbol:   method $(java.lang.String)
  location: class com.eniro.swat.ecoadmin.page.PlacePage
0
 

Author Comment

by:Bear2
ID: 40014385
public void removeNameReservation(String name) {
        for (PlaceNamePopular placeNamePopular: namePopularList){
            if (textEquals(name, placeNamePopular.summary)) if (isDisplayed(placeNamePopular.reservations)) {
                click(summaryPlaceNamePopular);

                    $("input:checked").prop("checked", false);

            }
        }
    }



Getting error message: java: cannot find symbol
  symbol:   method $(java.lang.String)
  location: class com.eniro.swat.ecoadmin.page.PlacePage


What to do?
0
 

Author Comment

by:Bear2
ID: 40017457
Ok the problem is that the solution is in java script and I am using java.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 40019210
Sorry... been away for the holiday.

Yes, the problem is you are using java and I've given you JavaScript. However you should still be able to use my code, it would just run on the client rather than the server.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Nadia
Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question