Bird
Raised Fist0
Agentic AIml~10 mins

Autonomous web browsing agents in Agentic AI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Arefresh_page
Bopen_url
Cclose_tab
Dclick_button
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that interact with page elements instead of opening a URL.
Confusing refreshing or closing with opening a page.
2fill in blank
medium

Complete 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'
Await_for_load
Btype_text
Cscroll_down
Dclick_element
Attempts:
3 left
💡 Hint
Common Mistakes
Using typing or scrolling methods instead of clicking.
Trying to wait for load instead of interacting.
3fill in blank
hard

Fix 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'
A['#main-title']
Bmain-title
C'#main-title'
Dmain_title
Attempts:
3 left
💡 Hint
Common Mistakes
Passing selector without quotes causing syntax errors.
Using variable names instead of selector strings.
4fill in blank
hard

Fill 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'
A'#' + id
Bid
C'#' + id.lower()
D'#' + str(id)
Attempts:
3 left
💡 Hint
Common Mistakes
Using the id variable without '#' causing selector errors.
Using inconsistent selectors in the comprehension.
5fill in blank
hard

Fill 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'
Alink
B'href'
Cl
D'src'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names like 'src' for links.
Using inconsistent variable names in the comprehension.