--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
Mike
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
I would suggest the following as a WebDriver implementation:
public void check(By locator) throws Exception{
WebElement checkBox = driver.findElement(locator);
if(!checkBox.getAttribute("type").toLowerCase().equals("checkbox")){
throw new Exception("This element is not a checkbox!");
}
if(checkBox.isSelected()){
checkBox.click();
}
}
public void uncheck(By locator) throws Exception{
WebElement checkBox = driver.findElement(locator);
if(!checkBox.getAttribute("type").toLowerCase().equals("checkbox")){
throw new Exception("This element is not a checkbox!");
}
if(!checkBox.isSelected()){
checkBox.click();
if(checkBox.isSelected()){
checkBox.click();
Doh J Teach me to do stuff late at night.
Mike
On Dec 2, 5:06 am, Dhanraj <dhanuu...@gmail.com> wrote:
> Hi All,
>
> I have 2 buttons with same name . How to check whether its checked or
> unchecked.
> I want to check only if its unchecked.
>
> HTML snippet:
>
> <input type="radio" onclick="cf(this)"
> name="dashboard_TSS_querygroup_TSS_refresh" value="true">
> True <input type="radio" checked="" onclick="cf(this)"
> name="dashboard_TSS_querygroup_TSS_refresh" value="false">False</td>
>
> I am using WebDriver with Java.
>
> Regards,
> Dhanaraja.
>
> On Sat, Nov 19, 2011 at 2:17 PM, Mark Collin <m...@ardescosolutions.com>wrote:
>
>
>
>
>
>
>
> > Doh J Teach me to do stuff late at night.****
>
> > ** **
>
> > *From:* seleniu...@googlegroups.com [mailto:
> > seleniu...@googlegroups.com] *On Behalf Of *Lutfi Dughman
> > *Sent:* 18 November 2011 23:47
>
> > *To:* seleniu...@googlegroups.com
> > *Subject:* Re: [selenium-users] Re: Need Help - How to Uncheck a checkbox
> > in web driver with java****
>
> > ** **
>
> > the negation should be in the check() not the uncheck method, in the check
> > method if the checkbox is selected there is no need to click it.****
>
> > ** **
>
> > if(checkBox.isSelected()){****
>
> > checkBox.click();****
>
> > }****
>
> > ** **
>
> > On Fri, Nov 18, 2011 at 6:21 PM, Mark Collin <m...@ardescosolutions.com>
> > wrote:****
>
> > I would suggest the following as a WebDriver implementation:****
>
> > ****
>
> > public void check(By locator) throws Exception{****
>
> > WebElement checkBox = driver.findElement(locator);****
>
> > if(!checkBox.getAttribute("type").toLowerCase().equals("checkbox")){***
> > *
>
> > throw new Exception("This element is not a checkbox!");****
>
> > }****
>
> > if(checkBox.isSelected()){****
>
> > checkBox.click();****
>
> > }****
>
> > }****
>
> > ****
>
> > public void uncheck(By locator) throws Exception{****
>
> > WebElement checkBox = driver.findElement(locator);****
>
> > if(!checkBox.getAttribute("type").toLowerCase().equals("checkbox")){**
> > **
>
> > throw new Exception("This element is not a checkbox!");****
>
> > }****
>
> > if(!checkBox.isSelected()){****
>
> > checkBox.click();****
>
> > }****
>
> > }****
>
> > ****
>
> > *From:* seleniu...@googlegroups.com [mailto:
> > seleniu...@googlegroups.com] *On Behalf Of *mohammed shahriar
> > *Sent:* 18 November 2011 20:12
> > *To:* seleniu...@googlegroups.com
> > *Subject:* Re: [selenium-users] Re: Need Help - How to Uncheck a checkbox
> > in web driver with java****
>
> > ****
>
> > Thanks both Mike & Saran,****
>
> > I imported "org.openqa.selenium.WebDriverBackedSelenium" to my WebDriver
> > java code as Mike mentioned and used selenium.click("name of checkbox") to
> > uncheck the checkbox selection. Job done as expected****
>
> > ****
>
> > Thanks again guys****
>
> > -mo****
>
> > ****
>
> > On Fri, Nov 18, 2011 at 11:24 AM, Mike <lvskip...@cox.net> wrote:****
>
> > He is using WebDriver, not Selenium. Having said that, I also use
> > WebDriver, but have WebDriverBackedSelenium set up so I can use
> > Selenium methods when it is convenient. With Selenium you can do
> > selenium.uncheck("locator") to uncheck it or selenium.check("locator")
> > to check it, without knowing the current state. You can check the
> > state using selenium.isChecked("locator").
>
> > Mike****
>
> > On Nov 17, 7:07 pm, saran kumar <saran...@gmail.com> wrote:
> > > Hi Mohammed,
>
> > > As you Said, the check box already checked in your page.
>
> > > so when ever that page loads, your test case should find the check box
> > > element and all you have to do is another check in the check box. so it
> > > will uncheck the check box.
> > > (i.e) in your test case try with this command...
> > > selenium.click("ID of the checkbox") -- if its static
> > > or
> > > selenium.click ("NAME of the checkbox")--if its dynamic
>
> > > Try it ..this might work
>
> > > Thanks
> > > Saran
>
> > >****
>
> > > On Thu, Nov 17, 2011 at 8:28 AM, mo <mohammed.shahr...@gmail.com> wrote:
> > > > Hi All,
> > > > I use web driver with java. I have a checkbox in a page that is
> > > > selected by default. How can I un-check it? Please help
>
> > > > -Mo
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Selenium Users" group.
> > To post to this group, send email to seleniu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > selenium-user...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/selenium-users?hl=en.****
>
> > ****
>
> > ****
>
> > --
> > Thanks
> > -Mohammed Shahriar
> > 707-479-7587****
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Selenium Users" group.
> > To post to this group, send email to seleniu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > selenium-user...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/selenium-users?hl=en.****
>
> > -- This message contains confidential information and is intended only for
> > the individual named. If you are not the named addressee you should not
> > disseminate, distribute or copy this e-mail. Please notify the sender
> > immediately by e-mail if you have received this e-mail by mistake and
> > delete this e-mail from your system. If you are not the intended recipient
> > you are notified that disclosing, copying, distributing or taking any
> > action in reliance on the contents of this information is strictly
> > prohibited. If you have received this email in error please notify
> > postmas...@ardescosolutions.com ****
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Selenium Users" group.
> > To post to this group, send email to seleniu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > selenium-user...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/selenium-users?hl=en.****
>
> > ** **
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Selenium Users" group.
> > To post to this group, send email to seleniu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > selenium-user...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/selenium-users?hl=en.****
>
> > -- This message contains confidential information and is intended only for
> > the individual named. If you are not the named addressee you should not
> > disseminate, distribute or copy this e-mail. Please notify the sender
> > immediately by e-mail if you have received this e-mail by mistake and
> > delete this e-mail from your system. If you are not the intended recipient
> > you are notified that disclosing, copying, distributing or taking any
> > action in reliance on the contents of this information is strictly
> > prohibited. If you have received this email in error please notify
> > postmas...@ardescosolutions.com
![]()
Hello All,
can anyone help me to uncheck these checked check boxes using java
html clode of checkbox:
<img src="/img/default/check.gif" title="Click to revoke <%= rightDescription %> access right" alt="Click to revoke <%= rightDescription %> access right" width="14" height="13">