ver Jan17th
updated the existing task configs
This commit is contained in:
@@ -298,11 +298,11 @@ class SetupController:
|
||||
# TODO
|
||||
raise NotImplementedError()
|
||||
|
||||
def _activate_window_setup(self, window_name: str):
|
||||
def _activate_window_setup(self, window_name: str, strict: bool = False, by_class: bool = False):
|
||||
if not window_name:
|
||||
raise Exception(f"Setup Open - Invalid path ({window_name}).")
|
||||
|
||||
payload = json.dumps({"window_name": window_name})
|
||||
payload = json.dumps({"window_name": window_name, "strict": strict, "by_class": by_class})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
@@ -317,6 +317,25 @@ class SetupController:
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.error("An error occurred while trying to send the request: %s", e)
|
||||
|
||||
def _close_window_setup(self, window_name: str, strict: bool = False, by_class: bool = False):
|
||||
if not window_name:
|
||||
raise Exception(f"Setup Open - Invalid path ({window_name}).")
|
||||
|
||||
payload = json.dumps({"window_name": window_name, "strict": strict, "by_class": by_class})
|
||||
headers = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
# send request to server to open file
|
||||
try:
|
||||
response = requests.post(self.http_server + "/setup" + "/close_window", headers=headers, data=payload)
|
||||
if response.status_code == 200:
|
||||
logger.info("Command executed successfully: %s", response.text)
|
||||
else:
|
||||
logger.error(f"Failed to close window {window_name}. Status code: %s", response.text)
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.error("An error occurred while trying to send the request: %s", e)
|
||||
|
||||
# Chrome setup
|
||||
def _chrome_open_tabs_setup(self, urls_to_open: List[str]):
|
||||
host = self.vm_ip
|
||||
|
||||
Reference in New Issue
Block a user