Update app.py
Browse files
app.py
CHANGED
@@ -3,23 +3,24 @@ from selenium import webdriver
|
|
3 |
from selenium.common.exceptions import WebDriverException
|
4 |
from selenium.webdriver.common.by import By
|
5 |
from gradio_client import Client
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
|
10 |
|
11 |
-
def
|
12 |
options = webdriver.ChromeOptions()
|
13 |
options.add_argument('--headless')
|
14 |
-
|
15 |
try:
|
16 |
-
|
17 |
-
url = 'https://www.
|
|
|
18 |
#<ol class="AmbQnf">
|
19 |
wd.get(url)
|
20 |
-
wd.implicitly_wait(
|
21 |
-
element = driver.find_element(By.
|
22 |
-
time.sleep(
|
23 |
return element.text
|
24 |
|
25 |
|
|
|
3 |
from selenium.common.exceptions import WebDriverException
|
4 |
from selenium.webdriver.common.by import By
|
5 |
from gradio_client import Client
|
6 |
+
from selenium.webdriver.support.wait import WebDriverWait
|
7 |
+
from selenium.webdriver.support import expected_conditions as EC
|
8 |
+
from selenium.webdriver.chrome.options import Options
|
9 |
|
10 |
|
11 |
+
def take_screenshot(url):
|
12 |
options = webdriver.ChromeOptions()
|
13 |
options.add_argument('--headless')
|
14 |
+
|
15 |
try:
|
16 |
+
wd = webdriver.Chrome(options=options)
|
17 |
+
url = 'https://www.google.com/search?q=zugverbindung+bad+kissingen+euerdorf'
|
18 |
+
#url = 'https://www.spiegel.de'
|
19 |
#<ol class="AmbQnf">
|
20 |
wd.get(url)
|
21 |
+
wd.implicitly_wait(5)
|
22 |
+
element = driver.find_element(By.ID, "exp0")
|
23 |
+
time.sleep(2)
|
24 |
return element.text
|
25 |
|
26 |
|