Interaction
Interacting with a Browser instance
Cookie inheritance
When a response is rendered, the cookies are inherited:
>>> resp = hrequests.get('https://somewebsite.com')
>>> page = resp.render()>>> page.cookies: RequestsCookieJar # cookies are inherited from the session
<RequestsCookieJar[Cookie(version=0, name='1P_JAR', value='2023-07-05-20', port=None, port_specified=False, domain='.somewebsite.com', domain_specified=True...Pulling page data
Get current page url:
>>> page.url: str
https://www.somewebsite.com/Get page content:
>>> page.text: str
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world\'s information, including webpag'
>>> page.content: bytes
b'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world\'s information, including webpag'Get the status of the last navigation:
>>> page.status_code: int
200
>>> page.reason: str
'OK'Parsing HTML from the page content:
Take a screenshot of the page:
Navigate the browser
Navigate to a url:
Navigate through page history:
Controlling elements
Click an element:
Hover over an element:
Type text into an element:
Drag and drop an element:
Check page elements
Check if a selector is visible and enabled:
Evaluate and return a script:
Awaiting events
Wait for a script or function to return a truthy value:
Wait for the URL to match:
Wait for an element to exist on the page:
Wait for an element to be enabled:
Screenshot an element:
Last updated