def test_download(self): launch_browser = selenium_webdriver.driver time.sleep(10) Element.fetch_element_by_xpath( launch_browser, ElementFeatureValue.ctrl_scanning_xpath).click() time.sleep(5) Element.fetch_element_by_partial_linktext( launch_browser, ElementFeatureValue.ctrl_download_tag).click()
def test_add_most_critical_advisories(self): launch_driver = selenium_webdriver.driver time.sleep(10) try: Element.fetch_element_by_class(launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext(launch_driver, AddDashboard.ctrl_most_critical_advisories).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element critical advisories not found")
def test_add_latest_advisories_per_watch_list(self): launch_driver = selenium_webdriver.driver time.sleep(10) try: Element.fetch_element_by_class(launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext(launch_driver, AddDashboard.ctrl_latest_advisories_per_watchList).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element latest advisories per watch not found")
def test_add_latest_advisories_affecting_your_security(self): launch_driver = selenium_webdriver.driver time.sleep(10) try: Element.fetch_element_by_class(launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext(launch_driver, AddDashboard.ctrl_latest_advisories_affecting_your_security).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element latest advisories affecting your security not found")
def test_add_devices_status_time(self): launch_driver = selenium_webdriver.driver time.sleep(10) try: Element.fetch_element_by_class(launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext(launch_driver, AddDashboard.ctrl_devices_status_time).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element device status time not found")
def test_add_your_latest_assigned_tickets(self): launch_driver = selenium_webdriver.driver time.sleep(10) try: Element.fetch_element_by_class(launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext(launch_driver, AddDashboard.ctrl_your_latest_assigned_tickets).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element not found")
def test_add_most_prevalent_insecure_software_installtions(self): launch_driver = selenium_webdriver.driver time.sleep(10) try: Element.fetch_element_by_class(launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext(launch_driver, AddDashboard.ctrl_most_prevalent_insecure_software_installtions).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element not found")
def test_add_latest_available_patches(self): launch_driver = SeleniumWebdriver.driver time.sleep(10) try: Element.fetch_element_by_class( launch_driver, AddDashboard.ctrl_add_class).click() Element.fetch_element_by_partial_linktext( launch_driver, AddDashboard.ctrl_latest_available_patches).click() Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click() except NoSuchElementException: print("element latest available patches not found")
def checkUser(self, usertype, username): print("userType, userName", usertype, username) if usertype == "default": print("I am printing default") Checkelements = [ 'Scanning', 'Results', 'Reporting', 'Administration', 'Configuration' ] elif usertype == "RWUser": print("I am not an default user") Checkelements = [ 'Scanning', 'Results', 'Reporting', 'Configuration' ] else: print("I am an RO/RE user\n") Checkelements = ['Results', 'Reporting'] try: for item in Checkelements: if item == 'Reporting' and usertype != 'ReUser': Element.fetch_element_by_partial_linktext( self.launch_browser, item).click() if (Element.fetch_element_by_partial_linktext( self.launch_browser, 'Database Access').is_displayed()): print("DBAccess Found") else: print("DBAcess not found") exit(1) else: Element.fetch_element_by_partial_linktext( self.launch_browser, item) print("item = ", item) except: print("NOT FOUND") exit(1)
def DownloadAgent(self): self.launch_browser = SeleniumWebDriver.browser time.sleep(5) Element.fetch_element_by_partial_linktext(self.launch_browser, 'Scanning').click() print("Scanning\n") for file in os.scandir(Credentials.downloadPath): print(file.path) os.unlink(file.path) try: time.sleep(5) Element.fetch_element_by_partial_linktext( self.launch_browser, "Download Local Agent").click() print("Found Donwlaod local Agent") except NoSuchElementException: print("Error: Download Local Agent") SeleniumWebDriver.browser.implicitly_wait(500) try: Element.fetch_element_by_partial_linktext( self.launch_browser, "Microsoft Windows").click() print("Found Donwlaod local Agent2") fileName = Credentials.downloadPath + "csia.exe" print(fileName) status = os.path.isfile(fileName) print("status", status) if status: size = os.path.getsize(fileName) print("size of csia=", size) else: print("File not found\n") info = os.stat(fileName) except NoSuchElementException: print("ERROR: Download Microsoft Windows")
def test_downloadversion(self): launch_browser = selenium_webdriver.driver time.sleep(10) Element.fetch_element_by_partial_linktext( launch_browser, ElementFeatureValue.ctrl_download_link).click() time.sleep(5)
def createUser( self, username, usertype, ): time.sleep(5) Element.fetch_element_by_partial_linktext(self.launch_browser, "Administration").click() print("Administration Clicked\n") time.sleep(5) Element.fetch_element_by_partial_linktext(self.launch_browser, "User Management").click() time.sleep(3) #Element.fetch_element_by_xpath(self.launch_browser,"//button[@id='ext-gen302']").click() Element.fetch_element_by_xpath( self.launch_browser, "//table[@id='sfw.csiUserManagement_create_new_button']/tbody/tr[2]/td[2]/em/button" ).click() Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_account_name']").send_keys( username) Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_account_username']").send_keys( username) Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_account_email']").send_keys( "*****@*****.**") Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_recipient_email']").send_keys( "*****@*****.**") if usertype == 'RWUser': Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_roleCheckbox_scanning']" ).click() Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_roleCheckbox_patching']" ).click() Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_roleCheckbox_scanning_filter']" ).click() Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_roleCheckbox_results']").click( ) Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_roleCheckbox_reporting']" ).click() Element.fetch_element_by_xpath( self.launch_browser, "//input[@id='sfw.csiUserManagement_roleCheckbox_db_access']" ).click() time.sleep(5) Element.fetch_element_by_xpath( self.launch_browser, "//table[@id='sfw.csiUserManagement_saveAccountButton']/tbody/tr[2]/td[2]/em/button" ).click() time.sleep(5) Element.fetch_element_by_xpath(self.launch_browser, "//button[@id='ext-gen98']").click()
def fullScreenView(self): time.sleep(2) Element.fetch_element_by_partial_linktext(self.launch_browser, "Fullscreen View").click() time.sleep(30)
def test_feature_vulnerability_click(self): new_driver = SeleniumWebdriver.driver time.sleep(10) Element.fetch_element_by_partial_linktext( new_driver, ElementValueFeatures.ctrl_vulnerability).click()