fde199b11dff18a7b716b28dcd2c2d9370bb6624
gperez2
  Thu Jun 29 12:17:37 2023 -0700
Fixing tmpdir for the cron, refs #30817

diff --git src/utils/qa/qaTestScript.py src/utils/qa/qaTestScript.py
index b97d906..90872a3 100755
--- src/utils/qa/qaTestScript.py
+++ src/utils/qa/qaTestScript.py
@@ -25,35 +25,42 @@
 # os.environ['TMPDIR'] = "/hive/users/lrnassar/selenium/chrom113/TMP"
 # ^IGNORE
 
 # Imports module
 from selenium.webdriver.chrome.options import Options
 from selenium.webdriver.common.by import By
 from selenium.webdriver.common.action_chains import ActionChains
 from selenium import webdriver
 from selenium.webdriver.common.keys import Keys
 from selenium.webdriver.support.ui import Select
 from selenium.webdriver.support.ui import WebDriverWait
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.common.exceptions import NoSuchElementException
 from selenium.common.exceptions import NoAlertPresentException
 import unittest, time, re, sys, argparse
+import getpass
+import os
 
+user = getpass.getuser()
 
-# Adding a tmpdir for the cron
-import os
-os.environ['TMPDIR'] = "/hive/users/$USER/selenium/chrom113/cron/TMP"
+
+#Make tmpdir for the cron
+try:
+   os.makedirs("/hive/users/"+user+"/selenium/chrom113/cron/TMP", exist_ok=True)
+except OSError as e:
+    print(f"Error creating directory: {e}")
+os.environ['TMPDIR'] = "/hive/users/"+user+"/selenium/chrom113/cron/TMP"
 
 def initialize_driver(headless):
     """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'
         driver = webdriver.Chrome('/hive/users/lrnassar/selenium/chrom113/chromedriver', options = options)
     else:
         # Asks user for the WebDriver location