Пример #1
0
 def test_logout(self):
     Element.fetch_element_by_id(self.launch_browser,ElementValueLogout.ctrl_logout).click()
     try:
         time.sleep(2)
         Element.fetch_element_by_id(self.launch_browser,"ext-gen100").click()
     except NoSuchElementException:
         print("Element not found\n")
Пример #2
0
 def click_on_svmscan(self):
     test = '/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads/*'
     os.system('rm ' + test)
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelementbyxpath(new_driver, element_value_features.ctrlsvmscan).click()
     mode = os.stat('/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads')[ST_MODE]
     file1 = os.stat('/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads/SVMScan.exe')[ST_MODE]
     if S_ISDIR(mode):
         print("/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads a directory")
         if (S_ISREG(file1)):
             print("SVMScan.exe is present")
             print("Last modified : %s" % time.ctime(os.path.getmtime(
                 '/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads/SVMScan.exe')))
             print("Created: %s" % time.ctime(os.path.getctime(
                 '/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads/SVMScan.exe')))
             size = os.stat('/home/preeti-automation-ubuntu/django-fundamentals-course/Downloads/SVMScan.exe')[
                 ST_SIZE]
             if size > 0:
                 print(size, "KB")
                 permission = oct(file1)[-3:]
                 print("permission are ", permission)
         else:
             print("SVMScan.exe doesnot exits\n")
             sys.exit()
     elif S_ISREG(mode):
         print("Its a file\n")
     else:
         print("unknown file\n")
Пример #3
0
class login1():
    launch_driver = selenium_webdriver.driver
    launch_driver.get(credentials.url)
    Element.fetchelement(launch_driver,
                         UiLogin.ctrlLogin).send_keys(credentials.user_name)
    Element.fetchelement(launch_driver,
                         UiLogin.ctrlPassword).send_keys(credentials.password)
    Element.fetchelement(launch_driver, UiLogin.btnSubmit).click()
Пример #4
0
 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()
Пример #5
0
 def testlogout(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelementbyxpath(
         new_driver,
         UserProfileandSignOut.btnUserProfileandSignout).click()
     Element.fetchelementbypartiallinktext(
         new_driver, UserProfileandSignOut.ctrlsignout).click()
Пример #6
0
 def exportCSV(self):
     print("Inside export CSv")
     Element.fetch_element_by_xpath(
         self.launch_browser,
         "//table[@class='x-btn x-btn-noicon x-btn-menu-active']/tbody/tr[2]/td[2]/em/button]"
     ).click()
     Element.fetch_element_by_xpath(
         self.launch_browser,
         "//table[@class='x-menu x-menu-floating x-layer']/ul/li[1]/a/span]"
     ).click()
Пример #7
0
 def test_remove(self):
         launch_driver = selenium_webdriver.driver
         time.sleep(10)
         element1 = Element.fetch_elements_by_classname(launch_driver, Dashboard.ctrl_classname)
         print (len(element1))
         for x in range(0, len(element1)):
                 if element1[x].is_displayed():
                         element1[x].click()
         time.sleep(10)
         Element.fetch_element_by_xpath(launch_driver, Dashboard.ctrl_save_button).click()
Пример #8
0
class SVMLogin:
    launch_driver = SeleniumWebdriver.driver
    launch_driver.get(Credentials.url)
    Element.fetch_element_by_id(launch_driver,
                                ElementValueLogin.ctrl_login).send_keys(
                                    Credentials.user_name)
    Element.fetch_element_by_id(launch_driver,
                                ElementValueLogin.ctrl_password).send_keys(
                                    Credentials.password)
    Element.fetch_element_by_id(launch_driver,
                                ElementValueLogin.btn_submit).click()
Пример #9
0
 def test_productbatabase(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     if(Element.fetchelement(new_driver , Research.ctrl_product_database).click()):
         print("Prodcuts should not be clickable issue raised SVM-453:failed")
     else:
         print("Product database is disabled cannot be clicked on:success")
Пример #10
0
 def test_modulearedisabled(self):
      new_driver = selenium_webdriver.driver
      time.sleep(10)
      if(Element.fetchelementbypartiallinktext(new_driver , VulnerabilityManager.ctrlvulnerability).click()):
          print("Vulnerabity Manager is enabled so script failed")
      else:
          print("Vulnerablity Manager is disabled:Success")
      if (Element.fetchelementbypartiallinktext(new_driver, Assessment.ctrl_assessment).click()):
          print("Assessment is enabled so script failed")
      else:
          print("Assessment is disabled:Success")
      if (Element.fetchelementbypartiallinktext(new_driver, Patching.ctrlPatching).click()):
          print("Patching is enabled so script failed")
      else:
          print("Patching is disabled:Success")
      if (Element.fetchelementbypartiallinktext(new_driver, Analytics.ctrl_analytics).click()):
          print("Analytics is enabled so script failed")
      else:
          print("Analytics is disabled:Success")
      if(Element.fetchelementbypartiallinktext(new_driver , Auditor.ctrl_auditor).click()):
          print("Auditor is enabled so script failed")
      else:
          print("Auditor is disabled:Success")
      if(Element.fetchelementbypartiallinktext(new_driver , PolicyManager.ctrl_policymanager).click()):
          print("Policy Manager is enabled so script failed")
      else:
          print("Policy Manager is disabled:Success")
      if(Element.fetchelement(new_driver , Settings.ctrlSettings).click()):
          print("Settings is enabled so script failed")
      else:
          print("Settings is disabled:Success")
Пример #11
0
 def testClickOnSvmScan(self):
     test = '/home/anusha/svm_automationproject/django-project/Downloads/*'
     os.system('rm ' + test)
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelementbyxpath(new_driver, Settings.ctrlsvmscan).click()
     mode = os.stat(
         '/home/anusha/svm_automationproject/django-project/Downloads/'
     )[ST_MODE]
     file1 = os.stat(
         '/home/anusha/svm_automationproject/django-project/Downloads/SVMScan.exe'
     )[ST_MODE]
     if S_ISDIR(mode):
         print(
             "/home/anusha/svm_automationproject/django-project/Downloads a directory"
         )
         if (S_ISREG(file1)):
             print("SVMScan.exe is present")
             print("Last modified : %s" % time.ctime(
                 os.path.getmtime(
                     '/home/anusha/svm_automationproject/django-project/Downloads/SVMScan.exe'
                 )))
             print("Created: %s" % time.ctime(
                 os.path.getctime(
                     '/home/anusha/svm_automationproject/django-project/Downloads/SVMScan.exe'
                 )))
             size = os.stat(
                 '/home/anusha/svm_automationproject/django-project/Downloads/SVMScan.exe'
             )[ST_SIZE]
             if size > 0:
                 print(size, "KB")
                 permission = oct(file1)[-3:]
                 print("permission are ", permission)
         else:
             print("SVMScan.exe doesnot exits\n")
             sys.exit()
     elif S_ISREG(mode):
         print("Its a file\n")
     else:
         print("unknown file\n")
Пример #12
0
 def test_login(self,username,password):
     new_browser = self.launch_browser.get(Credentials.url)
     time.sleep(2)
     Element.fetch_element_by_id(self.launch_browser, ElementValueLogin.ctrl_login).send_keys(username)
     Element.fetch_element_by_id(self.launch_browser, ElementValueLogin.ctrl_password).send_keys(password)
     Element.fetch_element_by_id(self.launch_browser, ElementValueLogin.btn_submit).click()
     time.sleep(2)
Пример #13
0
    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)
Пример #14
0
 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")
Пример #15
0
 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")
Пример #16
0
 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")
Пример #17
0
 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")
Пример #18
0
 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")
Пример #19
0
 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")
Пример #20
0
 def test_add_advisories(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_xpath(
             launch_driver, AddDashboard.ctrl_advisories).click()
         Element.fetch_element_by_xpath(launch_driver,
                                        Dashboard.ctrl_save_button).click()
     except NoSuchElementException:
         print("element advisories not found")
Пример #21
0
 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")
Пример #22
0
    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")
Пример #23
0
    def fullScreenView(self):

        time.sleep(2)
        Element.fetch_element_by_partial_linktext(self.launch_browser,
                                                  "Fullscreen View").click()
        time.sleep(30)
Пример #24
0
 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)
Пример #25
0
    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()
Пример #26
0
 def testClickOnDownloads(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelementbyxpath(new_driver, Settings.ctrlDownloads).click()
Пример #27
0
 def testClickOnAssessmentInSideSettings(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelement(new_driver, Settings.ctrlAssessment).click()
Пример #28
0
 def testfeatureSettingsClick(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelement(new_driver, Settings.ctrlSettings).click()
Пример #29
0
 def testfeatureVulnerabilityClick(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelementbypartiallinktext(
         new_driver, VulnerabilityManager.ctrlvulnerability).click()
Пример #30
0
 def testfeatureDashboardClick(self):
     new_driver = selenium_webdriver.driver
     time.sleep(10)
     Element.fetchelement(new_driver, Dashboard.ctrl_Dashboard).click()