Skip to content

Fails to run Playwright example #636

@alexkreidler

Description

@alexkreidler

Describe the bug

When I install and run the Playwright example, LaVague fails to do a simple 1-step click on a button to navigate

Output Logs
/Users/al/.asdf/installs/python/3.11.11/lib/python3.11/site-packages/lavague/core/__init__.py:21: UserWarning: Telemetry is turned on. To turn off telemetry, set your LAVAGUE_TELEMETRY to 'NONE'
  warnings.warn(warning_message, UserWarning)
2025-04-26 17:54:40,227 - INFO - Screenshot folder cleared
2025-04-26 17:54:44,490 - INFO - Thoughts:
- The current screenshot shows the documentation page of Hugging Face.
- The objective is to get the first paragraph of the "peft quicktour."
- The "peft quicktour" is likely a section or document within the Hugging Face documentation.
- The next step is to navigate to the "peft quicktour" section or document.

Next engine: Navigation Engine
Instruction: Click on 'peft quicktour' in the documentation list.
2025-04-26 17:54:48,509 - ERROR - Navigation error: No element found.
2025-04-26 17:54:49,224 - ERROR - Navigation error: No element found.
2025-04-26 17:54:50,031 - ERROR - Navigation error: No element found.
2025-04-26 17:54:50,912 - ERROR - Navigation error: No element found.
2025-04-26 17:54:51,478 - ERROR - Navigation error: No element found.
^C2025-04-26 17:54:53,024 - WARNING - The agent was interrupted.

output:
 None
generated code:
from playwright.sync_api import sync_playwright

p = sync_playwright().__enter__()
user_agent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
args = [
"--disable-web-security",
"--disable-site-isolation-trials",
]
browser = p.chromium.launch(
headless=False,
args=args,
)
context = browser.new_context(user_agent=user_agent)
user_agent=user_agent,
args=args,
)

context.add_init_script(JS_SETUP_GET_EVENTS)
page = context.new_page()
page.set_viewport_size({"width": 1080, "height": 1080})
page.goto("https://huggingface.co/docs")

[17:54:55] al@Als-MacBook-Air /Users/al/othercode/lavague > python test.py
/Users/al/.asdf/installs/python/3.11.11/lib/python3.11/site-packages/lavague/core/__init__.py:21: UserWarning: Telemetry is turned on. To turn off telemetry, set your LAVAGUE_TELEMETRY to 'NONE'
  warnings.warn(warning_message, UserWarning)
2025-04-26 18:03:27,276 - INFO - Screenshot folder cleared
2025-04-26 18:03:32,273 - INFO - **Thoughts:**

- The current screenshot shows the documentation page on Hugging Face.
- The objective is to get the first paragraph of the PEFT (Parameter-Efficient Fine-Tuning) quicktour.
- The PEFT quicktour is likely under a specific section or link related to PEFT or similar topics.
- The next step is to locate and navigate to the PEFT quicktour section.

**Next Engine:** Navigation Engine

**Instruction:** Click on the 'PEFT' link or section to access the quicktour.
2025-04-26 18:03:36,657 - ERROR - Navigation error: No element found.
2025-04-26 18:03:37,781 - ERROR - Navigation error: No element found.
2025-04-26 18:03:38,786 - ERROR - Navigation error: No element found.
2025-04-26 18:03:39,724 - ERROR - Navigation error: No element found.
2025-04-26 18:03:40,542 - ERROR - Navigation error: No element found.
2025-04-26 18:03:43,717 - INFO - **Thoughts:**

- The current screenshot shows the documentation page on Hugging Face.
- The objective is to get the first paragraph of the PEFT quicktour.
- The previous attempt to click on 'PEFT' failed, indicating it might not be directly visible or clickable.
- The page contains various sections related to libraries and tools, but 'PEFT' is not immediately visible.
- The best next step is to scan the page to locate the 'PEFT' section or link.

**Next engine:** Navigation Controls

**Instruction:** SCAN
2025-04-26 18:03:49,550 - INFO - **Thoughts:**

- The current screenshots show a documentation page on Hugging Face.
- The objective is to get the first paragraph of the PEFT quicktour.
- The PEFT section is visible under "Training & Optimization."
- Clicking on the "PEFT" link should lead to the quicktour page.

**Next Engine:** Navigation Engine

**Instruction:** Click on the 'PEFT' link under the "Training & Optimization" section.
2025-04-26 18:03:52,580 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:03:53,577 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:03:54,605 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:03:55,566 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:03:56,978 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:04:00,871 - INFO - **Thoughts:**

- The current screenshot shows a webpage with sections for "Training & Optimization" and "Collaboration & Extras."
- The objective is to get the first paragraph of the PEFT quicktour.
- Previous attempts to click on the 'PEFT' link have failed, indicating it might not be directly clickable or the action was not correctly executed.
- The 'PEFT' link is visible under the "Training & Optimization" section.
- A direct click on the 'PEFT' link should be attempted again to access the quicktour.

**Next engine:** Navigation Engine

**Instruction:** Click on the 'PEFT' link under the "Training & Optimization" section.
2025-04-26 18:04:03,767 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:04:04,732 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:04:05,756 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:04:07,188 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

2025-04-26 18:04:08,211 - ERROR - Navigation error: Locator.element_handle: Error: strict mode violation: locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a") resolved to 8 elements:
    1) <a target="_self" href="/docs/peft" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-red-500/15! hover:to-red-500/5! hover:border-red-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="PEFT Parameter-efficient")
    2) <a target="_self" href="/docs/accelerate" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-pink-500/15! hover:to-pink-500/5! hover:border-pink-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Accelerate Train PyTorch")
    3) <a target="_self" href="/docs/optimum" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-teal-500/15! hover:to-teal-500/5! hover:border-teal-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Optimum Optimize HF")
    4) <a target="_self" href="/docs/optimum-neuron" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-lime-500/15! hover:to-lime-500/5! hover:border-lime-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="AWS Trainium & Inferentia")
    5) <a target="_self" href="/docs/trl" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-blue-500/15! hover:to-blue-500/5! hover:border-blue-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="TRL Train transformers LMs")
    6) <a target="_self" href="/docs/safetensors" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-violet-500/15! hover:to-violet-500/5! hover:border-violet-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Safetensors Safe way to store")
    7) <a target="_self" href="/docs/bitsandbytes" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-slate-500/15! hover:to-slate-500/5! hover:border-slate-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Bitsandbytes Optimize and")
    8) <a target="_self" href="/docs/lighteval" class="bg-linear-to-r rounded-lg border border-gray-100 from-gray-100/70 to-transparent px-5 py-3 dark:border-gray-900 dark:from-gray-900 hover:from-amber-500/15! hover:to-amber-500/5! hover:border-amber-500/10! transtion-all duration-100 md:group-first:first:row-span-2"></a> aka get_by_role("link", name="Lighteval All-in-one toolkit")

Call log:
  - waiting for locator("xpath=/html/body/div/main/div/main/div[4]/div[2]/a")

^C2025-04-26 18:04:10,012 - WARNING - The agent was interrupted.

output:
 None
generated code:
from playwright.sync_api import sync_playwright

p = sync_playwright().__enter__()
user_agent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
args = [
"--disable-web-security",
"--disable-site-isolation-trials",
]
browser = p.chromium.launch(
headless=False,
args=args,
)
context = browser.new_context(user_agent=user_agent)
user_agent=user_agent,
args=args,
)

context.add_init_script(JS_SETUP_GET_EVENTS)
page = context.new_page()
page.set_viewport_size({"width": 1080, "height": 1080})
page.goto("https://huggingface.co/docs")
    def get_screenshots_whole_page(self, max_screenshots=30) -> list[str]:
        """Take screenshots of the whole page"""
        screenshot_paths = []

        current_screenshot_folder = self.get_current_screenshot_folder()

        for i in range(max_screenshots):
            # Saves a screenshot
            screenshot_path = self.save_screenshot(current_screenshot_folder)
            screenshot_paths.append(screenshot_path)
            self.scroll_down()
            self.wait_for_idle()

            if self.is_bottom_of_page():
                break

        self.previously_scanned = True
        return screenshot_paths

To Reproduce
Steps to reproduce the behavior:

  1. pip install lavague lavague.drivers.playwright
  2. Save code from https://github.com/lavague-ai/LaVague/blob/main/examples/playwright_agent_example.py to file
  3. Run with python playwright_agent_example.py
  4. See the agent open the page and scroll down to the correct link/button, but cannot click on it.

Expected behavior
It should click and navigate

If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions