Complete the code to create a simple autonomous web browsing agent that opens a webpage.
agent = AutonomousAgent() agent.[1]('https://example.com')
The open_url method is used to navigate the agent to a specific webpage URL.
Complete the code to make the agent click a button identified by its CSS selector.
agent.open_url('https://example.com') agent.[1]('#submit-button')
The click_element method allows the agent to simulate clicking a page element like a button.
Fix the error in the code to correctly extract text from a page element.
text = agent.get_element_text([1])The CSS selector string must be quoted to be passed correctly as an argument.
Fill both blanks to create a dictionary comprehension that maps element IDs to their text content.
texts = {id: agent.get_element_text([1]) for id in ids if agent.element_exists([2])}To select elements by their IDs, prepend '#' to the id string in both places.
Fill all three blanks to filter links, extract their URLs, and store them in a list.
links = [agent.get_element_attribute([1], [2]) for [3] in agent.find_elements('a') if agent.element_exists([1])]
Use a variable name like 'link' for each anchor element, get the 'href' attribute, and check if the element exists.
