From 1403f867792c8c0a642261899866cb8698f7dd34 Mon Sep 17 00:00:00 2001 From: Rachel Lee Nabors Date: Thu, 7 Nov 2024 12:15:59 +0000 Subject: [PATCH] updating the get_by_prompt example to have a visible result --- examples/get_by_prompt/get_by_prompt.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/get_by_prompt/get_by_prompt.py b/examples/get_by_prompt/get_by_prompt.py index 036be1a..554598e 100644 --- a/examples/get_by_prompt/get_by_prompt.py +++ b/examples/get_by_prompt/get_by_prompt.py @@ -4,7 +4,7 @@ from playwright.sync_api import sync_playwright # Set the URL to the desired website -URL = "https://thinking-tester-contact-list.herokuapp.com/" +URL = "https://duckduckgo.com/" def main(): @@ -15,12 +15,15 @@ def main(): # Navigate to the URL page.goto(URL) - # Get the sign up button by the prompt text - sign_up_btn = page.get_by_prompt(prompt="Sign up button") + # Get the search bar with the prompt text + search_bar = page.get_by_prompt("the search bar") - # Click the sign up button if it exists - if sign_up_btn: - sign_up_btn.click() + # Fill out the search bar, if it exists + if search_bar: + search_bar.fill("AgentQL") + + # Click the search button + page.get_by_prompt("the search button").click() # Used only for demo purposes. It allows you to see the effect of the script. page.wait_for_timeout(10000)