Spaces:
Paused
Paused
Update script.py
Browse files
script.py
CHANGED
|
@@ -1,25 +1,26 @@
|
|
| 1 |
-
import
|
| 2 |
-
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 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 |
-
|
| 11 |
-
|
| 12 |
-
# Wait for 5 seconds
|
| 13 |
-
await asyncio.sleep(5)
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
await run(playwright)
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|