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].reserva tionOnline " checked="checked" class="info">
<span>Online/Mobile</span>
<input type="checkbox" name="companyPopularNames[ 0].reserva tionPrint" class="info">
<span>Print</span>
<input type="checkbox" name="companyPopularNames[ 0].reserva tionVoice" 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!
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[
<span>Online/Mobile</span>
<input type="checkbox" name="companyPopularNames[
<span>Print</span>
<input type="checkbox" name="companyPopularNames[
<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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
public void removeNameReservation(Stri ng name) {
for (PlaceNamePopular placeNamePopular: namePopularList){
if (textEquals(name, placeNamePopular.summary)) if (isDisplayed(placeNamePopu lar.reserv ations)) {
click(summaryPlaceNamePopu lar);
$("input:checked").prop("c hecked", false);
}
}
}
Getting error message: java: cannot find symbol
symbol: method $(java.lang.String)
location: class com.eniro.swat.ecoadmin.pa ge.PlacePa ge
What to do?
for (PlaceNamePopular placeNamePopular: namePopularList){
if (textEquals(name, placeNamePopular.summary))
click(summaryPlaceNamePopu
$("input:checked").prop("c
}
}
}
Getting error message: java: cannot find symbol
symbol: method $(java.lang.String)
location: class com.eniro.swat.ecoadmin.pa
What to do?
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.
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.
ASKER
java: cannot find symbol
symbol: method $(java.lang.String)
location: class com.eniro.swat.ecoadmin.pa