private function selectRadioOption($xpath, $value)
    {
        $name = $this->getAttribute($xpath, 'name');

        if (null !== $name) {
            $name = json_encode($name);
            $function = <<<JS
(function(){
    for (var i = 0; i < document.forms.length; i++) {
        if (document.forms[i].elements[{$name}]) {
            var form  = document.forms[i];
            var elements = form.elements[{$name}];
            for (var f = 0; f < elements.length; f++) {
                var item = elements[f];
                if ("{$value}" == item.value) {
                    item.checked = true;

                    var event;
                    if (document.createEvent) {
                        event = document.createEvent("HTMLEvents");
                        event.initEvent("change", true, true);
                    } else {
                        event = document.createEventObject();
                        event.eventType = "change";
                    }

                    event.eventName = "change";

                    if (document.createEvent) {
                        item.dispatchEvent(event);
                    } else {
                        item.fireEvent("on" + event.eventType, event);
                    }
                }
            }
        }
    }
})()
JS;

            $this->executeScript($function);
        }
    }