Fails to run Playwright example
Author: alexkreidlerCreated Apr 26, 2025Updated Apr 26, 2025
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-100Source: lavague-ai/LaVague