diff --git a/test/requirements.txt b/test/requirements.txt new file mode 100644 index 0000000..c080797 --- /dev/null +++ b/test/requirements.txt @@ -0,0 +1,2 @@ +pyppeteer +memory_profiler \ No newline at end of file diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000..031a97e --- /dev/null +++ b/test/test.py @@ -0,0 +1,26 @@ +#!/usr/bin/python3 +import time + +import pyppeteer +import asyncio + +loop = asyncio.get_event_loop() +async def goto_page_url(url): + browser = await pyppeteer.launcher.connect( + loop=loop, + browserWSEndpoint='ws://localhost:3000' + ) + page = await browser.newPage() + await page.goto(url) + content = await page.content() + assert 'html' in content.lower(), "'html' should exist in the page fetch" + await page.close() + await browser.close() + +if __name__ == '__main__': + + async def main(): + now = time.time() + await asyncio.create_task(goto_page_url(url="https://google.com")) + print (f"Done in {time.time()-now:.2f} seconds") + loop.run_until_complete(main())