aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/download_markit_quotes.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/python/download_markit_quotes.py b/python/download_markit_quotes.py
index 25357ae7..7051d909 100644
--- a/python/download_markit_quotes.py
+++ b/python/download_markit_quotes.py
@@ -5,7 +5,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
-from selenium.common.exceptions import TimeoutException
+from selenium.common.exceptions import TimeoutException, ElementNotInteractableException
import time, os, shutil
from task_server.config import markit_login, markit_password
@@ -25,19 +25,27 @@ profile.set_preference('browser.download.dir', '/tmp')
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv')
driver = Firefox(profile)
-driver.get("https://markit.com/")
-driver.find_element_by_css_selector("a.loginLink").click()
-driver.find_element_by_css_selector("input[name=username]").send_keys(markit_login)
-driver.find_element_by_css_selector("input[name=password]").send_keys(markit_password)
-driver.find_element_by_css_selector("input[name=Login]").click()
-driver.switch_to.window(driver.window_handles[1])
-menu = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,
- "table.menuNavTable td:nth-of-type(2)")))
+driver.get("https://products.markit.com/")
+#driver.find_element_by_css_selector("a.loginLink").click()
+button = WebDriverWait(driver, 15).until(
+ EC.element_to_be_clickable((By.ID,
+ "notificationClose")))
+try:
+ button.click()
+except ElementNotInteractableException:
+ time.sleep(1)
+ button.click()
+
+driver.find_element_by_id("username").send_keys(markit_login)
+driver.find_element_by_id("password").send_keys(markit_password)
+driver.find_element_by_id("submit").click()
+menu = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID,
+ "QUOTES.Quotes.Quotes")))
time.sleep(1)
menu.click()
hiddenmenu = WebDriverWait(driver, 10).until(
- EC.element_to_be_clickable((By.CSS_SELECTOR,
- "div.MPopUpMenu div.popupContent table tbody tr:nth-of-type(3) td div")))
+ EC.element_to_be_clickable((By.ID,
+ "QUOTES.Quotes.Tranches")))
time.sleep(5)
hiddenmenu.click()
WebDriverWait(driver, 15).until(EC.frame_to_be_available_and_switch_to_it((By.NAME, "MFrame")))