Solved

Remove ticked checkboxes test automation java CSS

Posted on 2014-04-16
7
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 43

Accepted Solution

by:
Rob 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 43

Expert Comment

by:Rob
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20. The divisors of 12 are 1, 2, 3, 4, 6, 12 The divisors of 20 are 1, 2, 4, 5, 10 20 The highest number among the c…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

691 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