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")
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()
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")
def testClickOnDownloads(self): new_driver = selenium_webdriver.driver time.sleep(10) Element.fetchelementbyxpath(new_driver, Settings.ctrlDownloads).click()
def test_featurenotificationcenter(self): new_driver = selenium_webdriver.driver Element.fetchelementbypartiallinktext(new_driver, NotificationCenter.ctrlnotificationcenter).click() time.sleep(5) var = Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrl_information).is_displayed() print (var) if((Element.fetchelementbyxpath(new_driver,NotificationCenter.ctrl_information).is_displayed()) == True): print("no notications are present so to exit the page") return else: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlFilter).click() if (Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrl_filter_displayed).is_displayed()): print("Filter is visible") try: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlCrticality).click() print("Criticality dropbox is found") except: print("Criticality dropbox not found") try: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlFrom).click() print("From Dropbox is found") except: print("From Dropbox not found") try: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlTo).click() print("TO Dropbox is found") except: print("TO Dropbox not found") try: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlType).click() print("Type groupbox is found") except: print("Type groupbox not found") try: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlStatus).click() print("Status Dropbox is found") except: print("Status Dropbox not found") try: Element.fetchelementbyxpath(new_driver, NotificationCenter.ctrlSearchByKeyword).click() print("Search by Keyboard textbox is found") except: print("Search by Keyboard textbox not found") try: Element.fetchelementbycss(new_driver, NotificationCenter.ctrlFilterButton).click() print("Filter button is found") except: print("Filter button not found") try: Element.fetchelementbycss(new_driver, NotificationCenter.ctrlReset).click() print("Reset button is found") except: print("Reset button not found") else: print("Filter is disabled") Element.fetchelementbycss(new_driver, NotificationCenter.ctrl_delete_button).click() if (Element.fetchelementbycss(new_driver, NotificationCenter.ctrl_mailunread)).click(): print("mail is not yet read") else: print("email is read") Element.fetchelementbycss(new_driver, NotificationCenter.ctrl_select_all_checkbox).click() if (Element.fetchelementbycss(new_driver, NotificationCenter.ctrl_Actions).is_displayed()): print("Action button is present") Element.fetchelement(new_driver, NotificationCenter.ctrl_Actions).click() Element.fetchelementblinktext(new_driver, NotificationCenter.ctrl_MarkAsRead).click() print("All the notications as read by user") Element.fetchelementblinktext(new_driver, NotificationCenter.ctrl_MarkAsUnread).click() print("All the notifcations are unread by user") Element.fetchelementblinktext(new_driver, NotificationCenter.ctrl_Delete).click() print("All the notifications are deleted") else: print("Action button is not available")
def test_userprofile(self): new_driver = selenium_webdriver.driver time.sleep(10) Element.fetchelement(new_driver,UserProfile.ctrl_usr_profile).click() time.sleep(5) Element.fetchelementbypartiallinktext(new_driver,UserProfile.ctrl_change_password).click() time.sleep(5) Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_partiallink_cancel).click() time.sleep(5) Element.fetchelementbypartiallinktext(new_driver,UserProfile.ctrl_change_email).click() time.sleep(5) Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_partiallink_cancel).click() time.sleep(5) Element.fetchelementbypartiallinktext(new_driver,UserProfile.ctrl_verify_mobile_number).click() time.sleep(5) Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_partiallink_cancel).click() time.sleep(5) Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_edit_option_on_top).click() Element.fetchelementbyxpath(new_driver,UserProfile.ctrl_cancel_option_on_top).click() Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_edit_option_on_top).click() Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_save_button_on_top).click() time.sleep(10) #Element.fetchelementbyxpath(new_driver,UserProfile.ctrl_edit_button_down).click() #Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_cancel_option_in_bottom).click() #Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_edit_button_down).click() #Element.fetchelementbyxpath(new_driver, UserProfile.ctrl_save_option_in_bottom).click() # if __name__ == '__main__': # AdvisoryRole().test_login() # AdvisoryRole().test_featureClick() # AdvisoryRole().feature_notificationcenter() # AdvisoryRole().Research_module() # AdvisoryRole().ProductDatabase() # AdvisoryRole().module_are_disabled() # AdvisoryRole().User_Profile()
def test_researchmodule(self): new_driver = selenium_webdriver.driver #wait = WebDriverWait(new_driver, 10) #self.element1 = None #self.element = None #self.element = wait.until(EC.presence_of_all_elements_located((By.ID,"myDynamicID"))) #self.element1 = wait.until(EC.presence_of_all_elements_located(By.PARTIAL_LINK_TEXT,"MyPartialLinkText")) time.sleep(10) Element.fetchelementbypartiallinktext(new_driver, Research.ctrl_research).click() time.sleep(5) Element.fetchelement(new_driver , Research.ctrl_advisorydatabase).click() Element.fetchelementbyxpath(new_driver, Research.ctrl_advisories).click() Element.fetchelementbyxpath(new_driver, Research.ctrl_filter_button).click() if(Element.fetchelementbyxpath(new_driver , Research.ctrl_filter_options_are_hidden).is_displayed()): print("filter options are hidden") Element.fetchelementbyxpath(new_driver, Research.ctrl_filter_button).click() else: print("Filter options are available") Element.fetchelementbyxpath(new_driver, Research.ctrl_filter_button).click() try: Element.fetchelementbyxpath(new_driver, Research.ctrl_said).send_keys("SA81430") print("SAID filter option is working") except: print("SAID filter optio is not working") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_from).send_keys("2018-01-01") print("From date is working") except: print("From date is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_to).send_keys("2018-12-31") print("To date is working") except: print("To date is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_criticality).click() print("From date is working") except: print("Criticality option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_zeroday).click() print("Zero Day option is working") except: print("ZeroDay option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_solutionstatus).click() print("Solutuion status filter option is working") except: print("Solutionstatus filter option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_where).click() print("Where filter option is working") except: print("Where filter option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_cvss_score_min).send_keys(1) print("CVSS Score min filter option is working") except: print("CVSS Score min filter option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_cvss_score_max).send_keys(10) print("CVSS_score Max filter option is working") except: print("CVSS score max option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_advisory_type).click() print("advisory filter option is working") except: print("advisory filter option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_impact).click() print("Zimpact filter option is working") except: print("impact filter option is not working as expected") try: Element.fetchelementbyxpath(new_driver, Research.ctrl_cve).send_keys("CVE-2018-1000005") print("CVE filter option is working") except: print("CVE filter option is not working as expected") try: Element.fetchelementbycss(new_driver, Research.ctrl_filter).click() print("Filter option is working") except: print("Filter option is not working as expected") try: Element.fetchelementbycss(new_driver, Research.ctrl_reset).click() except: print("Reset filter option is not working properly") time.sleep(10) try: Element.fetchelementbycss(new_driver,Research.ctrl_search_by_keyword).send_keys("Ubuntu") print("Search by keyword button is working") except: print("Search by Keyword textbox is not working") time.sleep(10) Element.fetchelementbycss(new_driver,Research.ctrl_cancel).click() time.sleep(10) Element.fetchelementbyxpath(new_driver,Research.ctrl_title).click() time.sleep(5) Element.fetchelementbyxpath(new_driver,Research.ctrl_view_advisory).click() time.sleep(5) Element.fetchelementbyxpath(new_driver,Research.ctrl_close_advisory).click()
def click_on_downloads(self): new_driver = selenium_webdriver.driver time.sleep(10) Element.fetchelementbyxpath(new_driver, element_value_features.ctrlDownloads).click()