browser-use/browser-use · error · Exception

Element with given id not found

Error message

Element with given id not found

What it means

Error "Element with given id not found" thrown in browser-use/browser-use.

Source

Thrown at browser_use/browser/watchdogs/default_action_watchdog.py:826

					assert 'object' in result and 'objectId' in result['object'], (
						'Failed to find DOM element based on backendNodeId, maybe page content changed?'
					)
					object_id = result['object']['objectId']

					await cdp_session.cdp_client.send.Runtime.callFunctionOn(
						params={
							'functionDeclaration': 'function() { this.click(); }',
							'objectId': object_id,
						},
						session_id=session_id,
					)
					await asyncio.sleep(0.05)
					# Navigation is handled by BrowserSession via events
					return None
				except Exception as js_e:
					self.logger.warning(f'CDP JavaScript click also failed: {js_e}')
					if 'No node with given id found' in str(js_e):
						raise Exception('Element with given id not found')
					else:
						raise Exception(f'Failed to click element: {js_e}')

			# Find the largest visible quad within the viewport
			best_quad = None
			best_area = 0

			for quad in quads:
				if len(quad) < 8:
					continue

				# Calculate quad bounds
				xs = [quad[i] for i in range(0, 8, 2)]
				ys = [quad[i] for i in range(1, 8, 2)]
				min_x, max_x = min(xs), max(xs)
				min_y, max_y = min(ys), max(ys)

				# Check if quad intersects with viewport

View on GitHub (pinned to 6c73fced2f)

Solutions

  1. Re-fetch the element by its node id; the DOM may have changed.
  2. Verify the backend node id is still valid for the current document.

When it happens

Trigger: document.getElementById inside the click JS helper returns null for the element's id.

Common situations: Element id changed or element removed by page script between resolution and JS click fallback.


AI-assisted analysis of browser-use/browser-use@6c73fced2f (2026-08-14). Data as JSON: /api/errors/f88a64d8882a668b. Report an issue: GitHub.