lxml.html.InputElement
lxml :: html :: InputElement :: Class InputElement
[hide private]
[frames] | no frames]

Class InputElement

source code

            object --+    
                     |    
            InputMixin --+
                         |
    object --+           |
             |           |
etree._Element --+       |
                 |       |
 etree.ElementBase --+   |
                     |   |
        object --+   |   |
                 |   |   |
         HtmlMixin --+   |
                     |   |
           HtmlElement --+
                         |
                        InputElement

Represents an <input> element.

You can get the type with .type (which is lower-cased and defaults to 'text').

Also you can get and set the value with .value

Checkboxes and radios have the attribute input.checkable == True (for all others it is false) and a boolean attribute .checked.

Instance Methods [hide private]

Inherited from InputMixin: __repr__

Inherited from HtmlElement: cssselect, set

Inherited from etree.ElementBase: __init__, __new__

Inherited from etree._Element: __contains__, __copy__, __deepcopy__, __delitem__, __getitem__, __iter__, __len__, __nonzero__, __reversed__, __setitem__, addnext, addprevious, append, clear, extend, find, findall, findtext, get, getchildren, getiterator, getnext, getparent, getprevious, getroottree, index, insert, items, iter, iterancestors, iterchildren, iterdescendants, iterfind, itersiblings, itertext, keys, makeelement, remove, replace, values, xpath

Inherited from etree._Element (private): _init

Inherited from HtmlMixin: drop_tag, drop_tree, find_class, find_rel_links, get_element_by_id, iterlinks, make_links_absolute, resolve_base_href, rewrite_links, text_content

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  checkable
Boolean: can this element be checked?
  checked
Boolean attribute to get/set the presence of the checked attribute.
  type
Return the type of this element (using the type attribute).
  value
Get/set the value of this element, using the value attribute.

Inherited from InputMixin: name

Inherited from etree._Element: attrib, base, nsmap, prefix, sourceline, tag, tail, text

Inherited from HtmlMixin: base_url, body, classes, forms, head, label

Inherited from object: __class__

Property Details [hide private]

checkable

Boolean: can this element be checked?
Get Method:
unreachable.checkable(self) - Boolean: can this element be checked?

checked

Boolean attribute to get/set the presence of the checked attribute.

You can only use this on checkable input types.

Get Method:
unreachable.checked(self) - Boolean attribute to get/set the presence of the checked attribute.
Set Method:
unreachable.checked(self, value)

type

Return the type of this element (using the type attribute).
Get Method:
unreachable.type(self) - Return the type of this element (using the type attribute).
Set Method:
unreachable.type(self, value)

value

Get/set the value of this element, using the value attribute.

Also, if this is a checkbox and it has no value, this defaults to 'on'. If it is a checkbox or radio that is not checked, this returns None.

Get Method:
unreachable.value(self) - Get/set the value of this element, using the value attribute.
Set Method:
unreachable.value(self, value)
Delete Method:
unreachable.value(self)