Skip to content

Commit

Permalink
Fixed a booboo introduced with the previous patch
Browse files Browse the repository at this point in the history
Signed-off-by: timelyart <[email protected]>
  • Loading branch information
timelyart committed Sep 13, 2024
1 parent da12cd6 commit 56488c5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tv/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@
btn_data_window='button[id="data-window"]',
btn_data_window_active='button[id="data-window"][tabindex="0"]',
btn_watchlist='button[data-name="base"]',
btn_watchlist_submenu='div.widgetbar-page.active div[data-name="watchlists-button"]',
div_existing_watchlist_items='div[data-name="watchlists-dialog"] div[data-role="list-item"]',
div_watchlist_item='div[data-symbol-full]',
div_watchlist_item_by_symbol='div[data-symbol-full="{}"]',
Expand Down Expand Up @@ -416,7 +415,7 @@ def refresh(browser):
# Close alerts, banners and pop-ups
close_all_popups(browser)
# Close the watchlist menu if it is open
if find_element(browser, css_selectors['btn_watchlist_submenu'], By.CSS_SELECTOR, False, False, 0.5):
if find_element(browser, css_selectors['btn_watchlist_menu_menu'], By.CSS_SELECTOR, False, False, 0.5):
wait_and_click(browser, css_selectors['btn_watchlist'])


Expand Down Expand Up @@ -3616,15 +3615,15 @@ def get_screener_markets(browser, screener_yaml):
def update_watchlist(browser, name, markets):
log.info("creating/updating watchlist ...".format(name))
try:
if not find_element(browser, css_selectors['btn_watchlist_submenu'], except_on_timeout=False):
if not find_element(browser, css_selectors['btn_watchlist_menu_menu'], except_on_timeout=False):
wait_and_click(browser, css_selectors['btn_watchlist'])
time.sleep(DELAY_BREAK)
# remove any watchlists of the same name
remove_watchlists(browser, name)

# create new watchlist
if not find_element(browser, css_selectors['open_watchlist_submenu'], except_on_timeout=False, visible=True):
wait_and_click(browser, css_selectors['btn_watchlist_submenu'])
wait_and_click(browser, css_selectors['btn_watchlist_menu_menu'])
wait_and_click_by_text(browser, 'span', 'Create new list')

# set watchlist name
Expand Down Expand Up @@ -3691,7 +3690,7 @@ def update_watchlist(browser, name, markets):
def remove_watchlists(browser, name):
# After a watchlist is imported, TV opens it. Since we cannot delete a watchlist while opened, we can safely assume that any watchlist of the same name that can be deleted is old and should be deleted
if not find_element(browser, css_selectors['open_watchlist_submenu'], except_on_timeout=False, visible=True, ):
wait_and_click(browser, css_selectors['btn_watchlist_submenu'])
wait_and_click(browser, css_selectors['btn_watchlist_menu_menu'])
# Open dialog ith existing watchlists
wait_and_click_by_text(browser, 'span', 'Open list')
time.sleep(DELAY_BREAK)
Expand All @@ -3713,7 +3712,7 @@ def remove_watchlists(browser, name):
log.debug('watchlist {} removed'.format(name))
except StaleElementReferenceException:
# open the watchlists menu again and update the options to prevent 'element is stale' error
wait_and_click(browser, css_selectors['btn_watchlist_submenu'])
wait_and_click(browser, css_selectors['btn_watchlist_menu_menu'])
time.sleep(DELAY_BREAK)
el_options = find_elements(browser, css_selectors['div_existing_watchlist_items'])
time.sleep(DELAY_BREAK)
Expand Down Expand Up @@ -4609,7 +4608,7 @@ def retry_back_test_strategy_symbol(browser, inputs, properties, symbol, strateg
# Switching to Alert
close_alerts(browser)
# Close the watchlist menu if it is open
if find_element(browser, css_selectors['btn_watchlist_submenu'], By.CSS_SELECTOR, False, False, 0.5):
if find_element(browser, css_selectors['btn_watchlist_menu_menu'], By.CSS_SELECTOR, False, False, 0.5):
wait_and_click(browser, css_selectors['btn_watchlist_menu'])
first_symbol = True
else:
Expand Down

0 comments on commit 56488c5

Please sign in to comment.