diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..f89a480
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index de3fcfe..2fc783e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,9 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 8bc94ab..b642eb9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
-python-telegram-bot
-selenium==4.1.2
\ No newline at end of file
+python-telegram-bot==13.11
+selenium==4.1.2
diff --git a/src/StockTrackingBot.py b/src/StockTrackingBot.py
index 4c6a60c..e77b30a 100644
--- a/src/StockTrackingBot.py
+++ b/src/StockTrackingBot.py
@@ -4,6 +4,7 @@ import time
import traceback
import requests
+from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
@@ -118,12 +119,18 @@ if __name__ == '__main__':
# parse_page(browser)
# browser.close()
- # Refresh indefinitely
- while True:
+ def parse(tries: int = 0):
try:
parse_page(browser)
+ except StaleElementReferenceException:
+ if tries < 3:
+ parse(tries + 1)
except Exception as e:
traceback.print_exc()
- time.sleep(5)
+
+ # Refresh indefinitely
+ while True:
+ time.sleep(3)
+ parse()
browser.refresh()
time.sleep(2)