dimanche 24 juillet 2016

Selenium via Java - click on checkbox different response than manual clicking

I am having an issue clicking on a specific checkbox where it should check all the other checkbox s below it(root paramter). It used to work when I used this code on the element:

arguments[0].click();

I have tried to use normal click method but it does not work, I also tried to use:

        ("document.getElementById('" + checkBoxID + "').checked=true");
    ("document.getElementById('" + checkBoxID + "').onchange();")

What i have found is when i'm triggering the click by JS , the response it different than if i'd click on the checkbox manually . It is worth mentioning that clicking manually on the checkbox does trigger the event correctly and the other checkbox's below the main checkbox are checked as-well. Are there any other possible ways to trigger the onchange event? I tried to force onchange with this command:

document.getElementById("test").onchange()

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire