Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
seli
Posts : 7
Join date : 2012-05-11

How to check or uncheck the checkbox with IE8  Empty How to check or uncheck the checkbox with IE8

Thu Jun 14, 2012 9:04 pm
Hi all,
I have an issue when checking a checkbox with IE 8 by using InternetExplorerDriver: When I try clicking
on
the checkbox, the checkbox doesn't checked. The same code is working perfectly with FF3.6.
I know that IE Driver doesn't support cssSelector yet so I do not use css.

I have tried the followings:

driver.findElements(By.name("...")).click();
driver.findElement(By.xpath("//input[@name='...' and @value='...']") ).click();
....
and much more, but without any results
The part of HTML is:

Code:

<div class="input inputLevel3">
<div>
<label><input type="checkbox" value="yes" name="TPCActivate"><span id="XSLtpca0006">Activated</span></label>
</div>
</div>

I’m really stuck on this problem.
Please for your help.
avatar
Love Sharma
Regular Participant
Regular Participant
Posts : 27
Join date : 2012-06-01

How to check or uncheck the checkbox with IE8  Empty Re: How to check or uncheck the checkbox with IE8

Mon Jun 18, 2012 11:30 am
Hi Seli,

Click works fine to check the checkbox in IE8.
Just debug the code and confirm if it finds the element correctly before clicking in IE8?

Thanks,
Lovekesh
avatar
Sourav
Active particpant
Active particpant
Posts : 17
Join date : 2012-06-28

How to check or uncheck the checkbox with IE8  Empty Re: How to check or uncheck the checkbox with IE8

Thu Jun 28, 2012 5:57 pm
Hi Seli,
In case one alternate solution can be as below

String currChkboxValue = checkbox.getAttribute("checked");
if(currChkboxValue==null || "false".equalsIgnoreCase(currChkboxValue))
{
if(checkbox instanceof InternetExplorerElement)
{
checkbox.sendKeys(Keys.SPACE);
}
else
checkbox.click();

}
Sponsored content

How to check or uncheck the checkbox with IE8  Empty Re: How to check or uncheck the checkbox with IE8

Back to top
Permissions in this forum:
You cannot reply to topics in this forum