bb113eaa1fe0e8b96299c8e670b03c2180af94d6 gperez2 Wed Jun 18 16:40:15 2025 -0700 Code review edits, refs #35927 diff --git src/utils/qa/qaTestScript.py src/utils/qa/qaTestScript.py index 68c1500c20d..3979ea4d83b 100755 --- src/utils/qa/qaTestScript.py +++ src/utils/qa/qaTestScript.py @@ -76,32 +76,31 @@ """Initiates which webdriver to run for headless mode or local mode""" options = Options() if headless: options.add_argument('--headless') options.add_argument('--no-sandbox') options.add_argument("--headless") options.add_argument('--disable-dev-shm-usage') options.add_argument("--start-maximized") options.add_argument("--window-size=1920,1080") options.binary_location = '/hive/users/lrnassar/selenium/chrom113/chromeInstall/opt/google/chrome/google-chrome' service = Service('/hive/users/lrnassar/selenium/chrom113/chromedriver') driver = webdriver.Chrome(service=service, options=options) else: # Asks user for the WebDriver location webdriver_location = input("Enter the WebDriver location: ") - service = Service(executable_path=webdriver_location) - driver = webdriver.Chrome(service=service) + driver = webdriver.Chrome(service=Service(executable_path=webdriver_location)) return driver # Creates the command-line argument parser parser = argparse.ArgumentParser(description='Selenium script with headless/local mode.') parser.add_argument('--headless', action='store_true', help='Activate headless mode') parser.add_argument('--machine', type=str, help='Specify the machine URL') # Parses the command-line arguments args = parser.parse_args() # Asks the user for the website URL if not provided as a command-line argument if not args.machine: args.machine = input("Enter the machine URL (Ex. https://hgwbeta.soe.ucsc.edu):") # Initializes the driver based on the chosen mode @@ -113,35 +112,35 @@ def cartReset(): """The function does a cart reset""" a = ActionChains(driver) #identify element m = driver.find_element(By.LINK_TEXT, "Genome Browser") #hover over element a.move_to_element(m).perform() #identify sub menu element n = driver.find_element(By.LINK_TEXT, "Reset All User Settings") # hover over element and click a.move_to_element(n).click().perform() driver.implicitly_wait(2) def hover_and_click(driver, main_id, submenu_id): """Function that hovers the blue bar menu and clicks a menu item""" - a = ActionChains(driver) + action = ActionChains(driver) main = driver.find_element(By.ID, main_id) - a.move_to_element(main).perform() + action.move_to_element(main).perform() submenu = driver.find_element(By.ID, submenu_id) - a.move_to_element(submenu).click().perform() + action.move_to_element(submenu).click().perform() # Tests the Gateway page and home page driver.get(machine + "/cgi-bin/hgGateway") driver.get(machine + "/index.html") driver.find_element(By.LINK_TEXT, "Home").click() driver.find_element(By.LINK_TEXT, "Genomes").click() driver.get(machine + "/cgi-bin/hgGateway") driver.find_element(By.XPATH, "//div[@id='selectSpeciesSection']/div[2]/div[2]/div[2]/div").click() # Tests mm39 hgTracks driver.get(machine + "/cgi-bin/hgTracks?db=mm39") cartReset()