Solved

Remove ticked checkboxes test automation java CSS

Posted on 2014-04-16
7
225 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query 9 167
Remove lines with Vb script 28 142
Something related to Search engine 8 100
SSIS HTTP Connection and Script Task to consume RESTful Services API 2 507
Okay. So what exactly is the problem here? How often have we come across situations where we need to know if two strings are 'similar' but not necessarily the same? I have, plenty of times. Until recently, I thought any functionality like that wo…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now