get_element_by_id method
get_element_by_id
This method returns an Element
object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they’re a useful way to get access to a specific element quickly.
If you need to get access to an element which doesn’t have an ID, you can use Document.query_selector
to find the element using any selector.
Returns
An Element
object describing the DOM element object matching the specified ID, or null if no matching element was found in the document.
def get_element_by_id(self, element_id):
...
Parameter | Type | Description |
---|---|---|
element_id | str | The ID of the element to locate. The ID is case-sensitive string which is unique within the document; only one element may have any given ID. |
Remarks
Refer to official spec.
See Also
- module
aspose.html
- class
Element
- class
HTMLDocument