I am able to check the checkbox in web document but unable to uncheck the same checkbox.
Here is the code used:
repository.webdocument.checkboxmin.Checked = false.ToString();
Unable to uncheck checkbox in Webdocument
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
The "checked" property in the InputTag Adapter is directly mapped to the HTML "checked" attribute. So to uncheck the checkbox just set the "Checked" property to an empty string:
repository.webdocument.checkboxmin.Checked = "";
Because this is a bit counter-intuitive we will probably do something about that in a future release ..
Michael
Ranorex Team
repository.webdocument.checkboxmin.Checked = "";
Because this is a bit counter-intuitive we will probably do something about that in a future release ..
Michael
Ranorex Team
Unable to uncheck checkbox in Webdocument
Even repository.webdocument.checkboxmin.Checked = ""; is not working
Any other solutions for this????
Any other solutions for this????
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
If it is OK for you to use a method that uses PerformClick then you can try this method below:
Code: Select all
if (SelectCheckBox == true)
{
Report.Info("Selecting checkbox: " + CheckBoxName);
if (DOMCheckBox.Checked.ToUpper() != "TRUE")
{
Report.Debug(" Selected checkbox: " + CheckBoxName);
DOMCheckBox.EnsureVisible();
DOMCheckBox.Focus();
Thread.Sleep(1000);
DOMCheckBox.PerformClick();
}
else
{
Report.Info(" " + CheckBoxName + " was already Selected");
}
}
else
{
Report.Info("DE-Selecting checkbox: " + CheckBoxName);
if (DOMCheckBox.Checked.ToUpper() == "TRUE")
{
Report.Debug(" DE-Selected checkbox: " + CheckBoxName);
DOMCheckBox.EnsureVisible();
DOMCheckBox.Focus();
Thread.Sleep(1000);
DOMCheckBox.PerformClick();
}
else
{
Report.Info(" " + CheckBoxName + " was already DE-Selected");
}
}
Unable to uncheck checkbox in Webdocument
Html source for my checkbox looks like this.
<INPUT id=idchk_10011 type=checkbox CHECKED>.
repository.webdocument.checkboxmin.Checked = ""; isnt working. I am unable to uncheck the checkbox.
If i uncheck manually and try to check the checkbox it is working fine.
<INPUT id=idchk_10011 type=checkbox CHECKED>.
repository.webdocument.checkboxmin.Checked = ""; isnt working. I am unable to uncheck the checkbox.
If i uncheck manually and try to check the checkbox it is working fine.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Sorry, I cannot reproduce your problem.
The workaround Ciege suggested should work fine.
If you are using PerformClick() you *should* be able to skip
the EnsureVisible(), Focus() and Sleep() because it actually doesnt use the mouse.
@Ciege: you might want to use Delay.Seconds(1) or Delay.Ms(1000) instead of Thread.Sleep(). You can then use Delay.ScaleFactor to globally scale all your delays if you feel the need for it...
Michael
Ranorex Team
The workaround Ciege suggested should work fine.
If you are using PerformClick() you *should* be able to skip
the EnsureVisible(), Focus() and Sleep() because it actually doesnt use the mouse.
@Ciege: you might want to use Delay.Seconds(1) or Delay.Ms(1000) instead of Thread.Sleep(). You can then use Delay.ScaleFactor to globally scale all your delays if you feel the need for it...
Michael
Ranorex Team
Thanks for the tip. Is there a specific reason why I would choose Delay over Thread.Sleep? Or is that just "better" code?Support Team wrote: @Ciege: you might want to use Delay.Seconds(1) or Delay.Ms(1000) instead of Thread.Sleep(). You can then use Delay.ScaleFactor to globally scale all your delays if you feel the need for it...
Michael
Ranorex Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Well, if you use Delay() you can also do something like this:
Delay.Duration("2m")
and if you set the Delay.SpeedFactor you can globally scale all delays, so for example if you use Delay.Seconds(10) in some locations, and you set SpeedFactor = 2 then all delays are reduced to 5 seconds.
(Edit: the example described it backwards)
It's also used by the generated recorder code, because of the speed factor and better readibility. But its definitely no problem if you use Thread.Sleep() instead.
Michael
Ranorex Team
Delay.Duration("2m")
and if you set the Delay.SpeedFactor you can globally scale all delays, so for example if you use Delay.Seconds(10) in some locations, and you set SpeedFactor = 2 then all delays are reduced to 5 seconds.
(Edit: the example described it backwards)
It's also used by the generated recorder code, because of the speed factor and better readibility. But its definitely no problem if you use Thread.Sleep() instead.
Michael
Ranorex Team
Last edited by Support Team on Sat May 30, 2009 5:09 pm, edited 1 time in total.
Unable to uncheck checkbox in Webdocument
Thanks for your solutions , but i have tried with these. None of them worked
Any more solutions left.
Any more solutions left.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact: