Link to home
Start Free TrialLog in
Avatar of Bear2
Bear2

asked on

Remove ticked checkboxes test automation java CSS

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!
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bear2
Bear2

ASKER

I'm getting this error message:


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

ASKER

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?
Avatar of Bear2

ASKER

Ok the problem is that the solution is in java script and I am using java.
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.