From 3a619ee08f47ea0974ed83d45cac40dabb104441 Mon Sep 17 00:00:00 2001 From: Hex Ripley Date: Thu, 6 Mar 2025 15:02:04 -0800 Subject: [PATCH] Get the href within the tags rather than click them. --- AutoColor2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AutoColor2.py b/AutoColor2.py index 8f4fd83..54e6cd8 100644 --- a/AutoColor2.py +++ b/AutoColor2.py @@ -41,7 +41,8 @@ def dumb_make_tags(queues,tags,driver): for tag in tags: if found_string(queues, tag.text.lower()) == False: driver.execute_script("arguments[0].scrollIntoView(true);", tag) - ac.context_click(tag).perform() + tag_href = tag.find_element(By.TAG_NAME, "a").get_attribute("href") + driver.execute_script("window.open(arguments[0]);", tag_href) WebDriverWait(driver, 10).until(EC.number_of_windows_to_be(2)) for window_handle in driver.window_handles: if window_handle != original_window: @@ -81,7 +82,8 @@ def guided_make_tags(queues,tags,driver): for tag in tags: if found_string(queues, tag.text.lower()) == False: driver.execute_script("arguments[0].scrollIntoView(true);", tag) - ac.context_click(tag).perform() + tag_href = tag.find_element(By.TAG_NAME, "a").get_attribute("href") + driver.execute_script("window.open(arguments[0]);", tag_href) WebDriverWait(driver, 10).until(EC.number_of_windows_to_be(2)) for window_handle in driver.window_handles: if window_handle != original_window: @@ -127,7 +129,8 @@ def smart_make_tags(queues,tags,driver): if found_string(queues, tag.text.lower()) == False: lowest_queue = find_lowest_and_increment(tag_count) driver.execute_script("arguments[0].scrollIntoView(true);", tag) - ac.context_click(tag).perform() + tag_href = tag.find_element(By.TAG_NAME, "a").get_attribute("href") + driver.execute_script("window.open(arguments[0]);", tag_href) WebDriverWait(driver, 10).until(EC.number_of_windows_to_be(2)) for window_handle in driver.window_handles: if window_handle != original_window: