Skip to content

Commit 8331944

Browse files
committed
search microsoft.com example
1 parent a6f7c3e commit 8331944

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

scripts/search_microsoft_com.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from playwright.sync_api import sync_playwright
2+
3+
with sync_playwright() as playwright:
4+
browser = playwright.chromium.launch(headless=False)
5+
context = browser.new_context()
6+
page = context.new_page()
7+
8+
page.goto("https://www.microsoft.com/ja-jp/")
9+
page.get_by_role("button", name="Microsoft.com を検索").click()
10+
page.get_by_role("combobox", name="検索が展開されています").fill("xbox controller")
11+
page.get_by_role("button", name="Microsoft.com を検索").click()
12+
13+
# wait for 5 seconds to let the search results load
14+
page.wait_for_timeout(5000)
15+
16+
context.close()
17+
browser.close()

0 commit comments

Comments
 (0)