-
Notifications
You must be signed in to change notification settings - Fork 7
/
refresh.py
32 lines (26 loc) · 1.09 KB
/
refresh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# Path to the WebDriver executable (download from Selenium website)
#driver_path = '/path/to/webdriver/executable'
chrome_options = Options()
chrome_options.add_argument('--headless') # Run in headless mode
chrome_options.add_argument('--disable-gpu') # Disable GPU acceleration
# Initialize the WebDriver for Chrome
#driver = webdriver.Chrome(executable_path=driver_path)
driver = webdriver.Chrome(options=chrome_options)
# Open the Shiny app URL
driver.get('http://localhost:8090/?tab=dashboard_tab')
# Wait for specific element to be present
try:
element = WebDriverWait(driver, 3600).until(
EC.presence_of_element_located((By.ID, "httpvendor"))
)
print("Element found:", element.text)
except:
print("Element not found within 10 seconds")
# Close the browser window
driver.quit()