Skip to content

browser.get.html#

Functions#

element_inner(xpath, timeout=None) #

Get inner HTML of an element by XPath.

Parameters:

Name Type Description Default
xpath str

XPath of the element.

required
timeout float | None

In seconds. Timeout to wait for element. If None, the global timeout setting is used (default 5 seconds).

None

Returns:

Type Description
str

Inner HTML of an element.

Example

Get the inner HTML source of an element:

inner_html = browser.get.html.element_inner("//div[@id='content']")
print(inner_html)

element_outer(xpath, timeout=None) #

Get outer HTML of an element by XPath.

Parameters:

Name Type Description Default
xpath str

XPath of the element.

required
timeout float | None

In seconds. Timeout to wait for element. If None, the global timeout setting is used (default 5 seconds).

None

Returns:

Type Description
str

Outer HTML of an element.

Example

Get the outer HTML source of an element:

outer_html = browser.get.html.element_outer("//div[@id='content']")
print(outer_html)

page_source() #

Get HTML source of the current page.

Returns:

Type Description
str

HTML page source.

Example
page_source = browser.get.html.page_source()
print(page_source)