text: # Generated by Selenium IDE
  import pytest
  import time
  import json
  from selenium import webdriver
  from selenium.webdriver.common.by import By
  from selenium.webdriver.common.action_chains import ActionChains
  from selenium.webdriver.support import expected_conditions
  from selenium.webdriver.support.wait import WebDriverWait
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  
  class TestHSP11bis():
    def setup_method(self, method):
      self.driver = webdriver.Chrome()
      self.vars = {}
    
    def teardown_method(self, method):
      self.driver.quit()
    
    def wait_for_window(self, timeout = 2):
      time.sleep(round(timeout / 1000))
      wh_now = self.driver.window_handles
      wh_then = self.vars["window_handles"]
      if len(wh_now) > len(wh_then):
        return set(wh_now).difference(set(wh_then)).pop()
    
    def test_hSP11bis(self):
      self.driver.get("https://nsis.sanita.it/")
      self.driver.set_window_size(1050, 836)
      self.driver.switch_to.frame(0)
      self.driver.switch_to.frame(0)
      self.driver.find_element(By.NAME, "Ecom_User_ID").send_keys("mi141180")
      self.driver.find_element(By.NAME, "Ecom_Password").send_keys("Palmito.35")
      self.driver.find_element(By.CSS_SELECTOR, "table:nth-child(4) > tbody > tr > td").click()
      self.driver.find_element(By.NAME, "Ecom_Password").click()
      self.driver.find_element(By.NAME, "Ecom_Password").click()
      element = self.driver.find_element(By.NAME, "Ecom_Password")
      actions = ActionChains(self.driver)
      actions.double_click(element).perform()
      self.driver.find_element(By.NAME, "loginButton2").click()
      self.driver.switch_to.default_content()
      self.driver.switch_to.default_content()
      self.driver.switch_to.frame(1)
      self.vars["window_handles"] = self.driver.window_handles
      self.driver.find_element(By.LINK_TEXT, "Flussi Informativi").click()
      self.vars["win74"] = self.wait_for_window(2000)
      self.vars["root"] = self.driver.current_window_handle
      self.driver.switch_to.window(self.vars["win74"])
      self.driver.find_element(By.CSS_SELECTOR, "tr:nth-child(4) > td td").click()
      self.vars["window_handles"] = self.driver.window_handles
      self.driver.find_element(By.CSS_SELECTOR, "td:nth-child(1) > table img").click()
      self.vars["win7095"] = self.wait_for_window(2000)
      self.driver.switch_to.window(self.vars["win7095"])
      self.driver.switch_to.frame(0)
      self.driver.switch_to.frame(2)
      self.driver.find_element(By.ID, "MyDocs_treeView_treeNode8_name").click()
      self.driver.find_element(By.ID, "ListingURE_detailView_listColumn_1_0_1").click()
      self.driver.find_element(By.ID, "ListingURE_detailView_listColumn_1_0_1").click()
      element = self.driver.find_element(By.ID, "ListingURE_detailView_listColumn_1_0_1")
      actions = ActionChains(self.driver)
      actions.double_click(element).perform()
      self.driver.find_element(By.ID, "ListingURE_detailView_listColumn_0_0_1").click()
      self.driver.find_element(By.ID, "ListingURE_detailView_listColumn_0_0_1").click()
      element = self.driver.find_element(By.XPATH, "//td[contains(.,\'HSP11bis\')]")
      actions = ActionChains(self.driver)
      actions.double_click(element).perform()
      self.driver.switch_to.default_content()
      self.driver.switch_to.frame(5)
      self.driver.switch_to.frame(0)
      self.driver.switch_to.frame(9)
      time.sleep(100000)
      self.driver.find_element(By.CSS_SELECTOR, "tr:nth-child(2) > .s-64 .nwt").click()
      self.driver.switch_to.default_content()
      self.driver.find_element(By.CSS_SELECTOR, "#iconleft__dhtmlLib_298 > div").click()
      dropdown = self.driver.find_element(By.ID, "fileTypeList")
      dropdown.find_element(By.XPATH, "//option[. = 'Excel (.xlsx)']").click()
      element = self.driver.find_element(By.ID, "fileTypeList")
      actions = ActionChains(self.driver)
      actions.move_to_element(element).click_and_hold().perform()
      element = self.driver.find_element(By.ID, "fileTypeList")
      actions = ActionChains(self.driver)
      actions.move_to_element(element).perform()
      element = self.driver.find_element(By.ID, "fileTypeList")
      actions = ActionChains(self.driver)
      actions.move_to_element(element).release().perform()
      self.driver.find_element(By.ID, "fileTypeList").click()
      self.driver.find_element(By.ID, "frame_cont_exportFileWholeFrameZone").click()
      self.driver.find_element(By.ID, "Btn_csvopOKButton").click()
      self.driver.switch_to.default_content()
      self.driver.switch_to.default_content()
      self.driver.find_element(By.ID, "logoffLink-button").click()
      self.driver.close()
      self.driver.switch_to.window(self.vars["win74"])
      self.driver.close()
      self.driver.switch_to.window(self.vars["root"])
      self.driver.switch_to.frame(0)
      self.driver.find_element(By.CSS_SELECTOR, "b").click()
      self.driver.close()
    
  