Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,6 +44,7 @@ def run_script(url: str, height: int, width: int, check_b,check_h):
|
|
| 44 |
if is_url:
|
| 45 |
options = webdriver.ChromeOptions()
|
| 46 |
options.add_argument('--headless')
|
|
|
|
| 47 |
options.add_argument('--no-sandbox')
|
| 48 |
options.add_argument('--disable-dev-shm-usage')
|
| 49 |
mes='<center>operation success'
|
|
@@ -56,9 +57,9 @@ def run_script(url: str, height: int, width: int, check_b,check_h):
|
|
| 56 |
driver.set_window_size(int(width), int(height))
|
| 57 |
page = driver.find_element(By.TAG_NAME, "html")
|
| 58 |
print (dir(page))
|
| 59 |
-
page.send_keys('theme','gab-black')
|
| 60 |
print (page.get_attribute('theme'))
|
| 61 |
-
driver.execute_script("arguments[0].theme=
|
| 62 |
main_head = driver.find_element(By.CLASS_NAME, "main-content-header")
|
| 63 |
head_shot = main_head.screenshot(f'head-{uid}-tmp.png')
|
| 64 |
|
|
|
|
| 44 |
if is_url:
|
| 45 |
options = webdriver.ChromeOptions()
|
| 46 |
options.add_argument('--headless')
|
| 47 |
+
options.add_argument('--force-dark-mode')
|
| 48 |
options.add_argument('--no-sandbox')
|
| 49 |
options.add_argument('--disable-dev-shm-usage')
|
| 50 |
mes='<center>operation success'
|
|
|
|
| 57 |
driver.set_window_size(int(width), int(height))
|
| 58 |
page = driver.find_element(By.TAG_NAME, "html")
|
| 59 |
print (dir(page))
|
| 60 |
+
#page.send_keys('theme','gab-black')
|
| 61 |
print (page.get_attribute('theme'))
|
| 62 |
+
driver.execute_script("arguments[0].theme=gab-black;",page)
|
| 63 |
main_head = driver.find_element(By.CLASS_NAME, "main-content-header")
|
| 64 |
head_shot = main_head.screenshot(f'head-{uid}-tmp.png')
|
| 65 |
|