def set(value)
if tag_name == 'input' and type == 'radio'
other_radios_xpath = XPath.generate { |x| x.anywhere(:input)[x.attr(:name).equals(self[:name])] }.to_s
driver.dom.xpath(other_radios_xpath).each { |node| node.remove_attribute("checked") }
native['checked'] = 'checked'
elsif tag_name == 'input' and type == 'checkbox'
if value && !native['checked']
native['checked'] = 'checked'
elsif !value && native['checked']
native.remove_attribute('checked')
end
elsif tag_name == 'input'
if (type == 'text' || type == 'password') && self[:maxlength]
value = value[0...self[:maxlength].to_i]
end
native['value'] = value.to_s
elsif tag_name == "textarea"
native.content = value.to_s
end
end