Mythus commited on
Commit
236282f
·
verified ·
1 Parent(s): 756c8e6

Update script.py

Browse files
Files changed (1) hide show
  1. script.py +21 -20
script.py CHANGED
@@ -1,25 +1,26 @@
1
- import asyncio
2
- from playwright.async_api import async_playwright
 
 
3
 
4
- async def run(playwright):
5
- firefox = playwright.firefox
6
- browser = await firefox.launch(headless=True)
7
- context = await browser.new_context()
8
- page = await context.new_page()
9
 
10
- await page.goto('https://d000d.com/e/9b3w45p3h2gz')
11
-
12
- # Wait for 5 seconds
13
- await asyncio.sleep(5)
14
 
15
- # Get and print the HTML of the page
16
- print(await page.content())
17
-
18
- await browser.close()
19
 
20
- async def main():
21
- async with async_playwright() as playwright:
22
- await run(playwright)
23
 
24
- # Run the function
25
- asyncio.run(main())
 
 
 
 
 
 
 
1
+ import time
2
+ import undetected_chromedriver as uc
3
+ from selenium.webdriver.common.by import By
4
+ from seleniumbase import BaseCase
5
 
6
+ class MyTestClass(BaseCase):
 
 
 
 
7
 
8
+ def test_basic(self):
9
+ options = uc.ChromeOptions()
 
 
10
 
11
+ # Uncomment the line below if you'd like to use a headless browser
12
+ # options.headless=True
13
+
14
+ driver = uc.Chrome(options=options)
15
 
16
+ driver.get("https://d000d.com/e/9b3w45p3h2gz")
17
+ time.sleep(5) # wait 5 seconds before getting the page source
 
18
 
19
+ print(driver.page_source) # print the page source
20
+
21
+ driver.quit()
22
+
23
+
24
+ if __name__ == '__main__':
25
+ case = MyTestClass()
26
+ case.test_basic()