Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a simple autonomous web browsing agent that opens a webpage.
Agentic_ai
agent = AutonomousAgent() agent.[1]('https://example.com')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to make the agent click a button identified by its CSS selector.
Agentic_ai
agent.open_url('https://example.com') agent.[1]('#submit-button')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the code to correctly extract text from a page element.
Agentic_ai
text = agent.get_element_text([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary comprehension that maps element IDs to their text content.
Agentic_ai
texts = {id: agent.get_element_text([1]) for id in ids if agent.element_exists([2])} Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to filter links, extract their URLs, and store them in a list.
Agentic_ai
links = [agent.get_element_attribute([1], [2]) for [3] in agent.find_elements('a') if agent.element_exists([1])]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
