()
| 4 | |
| 5 | |
| 6 | async def main(): |
| 7 | driver = await cdp_driver.start_async() |
| 8 | endpoint_url = driver.get_endpoint_url() |
| 9 | |
| 10 | async with async_playwright() as p: |
| 11 | browser = await p.chromium.connect_over_cdp(endpoint_url) |
| 12 | page = browser.contexts[0].pages[0] |
| 13 | await page.goto("https://copilot.microsoft.com") |
| 14 | await page.wait_for_selector("textarea#userInput") |
| 15 | await page.wait_for_timeout(1000) |
| 16 | query = "Playwright Python connect_over_cdp() sync example" |
| 17 | await page.fill("textarea#userInput", query) |
| 18 | await page.wait_for_timeout(2000) |
| 19 | await page.click('button[data-testid="submit-button"]') |
| 20 | await driver.sleep(5.25) |
| 21 | await driver.solve_captcha() |
| 22 | await page.wait_for_selector('button[data-testid*="-thumbs-up"]') |
| 23 | await page.wait_for_timeout(4000) |
| 24 | await page.click('button[data-testid*="scroll-to-bottom"]') |
| 25 | await page.wait_for_timeout(3000) |
| 26 | chat_results = '[data-testid="highlighted-chats"]' |
| 27 | result = await page.locator(chat_results).inner_text() |
| 28 | print(result.replace("\n\n", " \n")) |
| 29 | |
| 30 | |
| 31 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…