def test(self): driver = webdriver.Chrome( executable_path= "C:/Users/kruthi.p/PycharmProjects/main/drivers/chromedriver.exe") driver.maximize_window() # Method that maximize the window print("started") driver.get(Utils.URL) # get the EOT_C Web URL from the Utils page login_obj = LoginPage(driver) # Object creation for loginpage class login_obj.Login( "*****@*****.**", "Sisa@123" ) # Function call to login method ;1st parameter = emailid ; 2nd parameter = password; keyword_obj = Anomaly_management(driver) keyword_obj.anomaly_keyword_detection() #keyword_obj.AKM_add_keyword_button() driver.find_element_by_xpath("//*[@id='openDialogID']").click() time.sleep(3) keyword_obj.AKM_new_keyword_logstash_field("message") keyword_obj.AKM_new_keyword_match_condition("Match") keyword_obj.AKM_new_keyword_keyword_duration(2) keyword_obj.AKM_Keyword_add_keyword("dskfks") time.sleep(3) keyword_obj.AKM_new_keyword_cancel() expected_title = "> Anomaly Keywords" element = driver.find_element_by_xpath( "//*[@id='content']/h2/span").text print(element) self.assertEqual(expected_title, element, "title is not Anomaly Keywords") driver.close() driver.quit()
def test(self): driver = webdriver.Chrome( executable_path= "C:/Users/kruthi.p/PycharmProjects/Test_Automation_Framework/drivers/chromedriver.exe" ) driver.maximize_window() # Method that maximize the window print("started") driver.get(Utils.URL) # get the EOT_C Web URL from the Utils page login_obj = LoginPage(driver) # Object creation for loginpage class login_obj.Login( "*****@*****.**", "Sisa@123" ) # Function call to login method ;1st parameter = emailid ; 2nd parameter = password; keyword_obj = Anomaly_management(driver) keyword_obj.anomaly_keyword_detection() time.sleep(3) keyword_obj.AKM_main_checkbox() time.sleep(3) keyword_obj.AMK_delete_button() keyword_obj.AKM_delete_confirmation_yes() value = 1 length = len( driver.find_elements_by_xpath("//*[@id='dt_basic']/tbody/tr")) print(length) self.assertEqual(length, value, "1 or more Records exist in the table") time.sleep(3) driver.quit()
def test(self): driver = webdriver.Chrome( executable_path= "C:/Users/kruthi.p/PycharmProjects/main/drivers/chromedriver.exe") driver.maximize_window() # Method that maximize the window print("started") driver.get(Utils.URL) # get the EOT_C Web URL from the Utils page login_obj = LoginPage(driver) # Object creation for loginpage class login_obj.Login( "*****@*****.**", "Sisa@123" ) # Function call to login method ;1st parameter = emailid ; 2nd parameter = password; keyword_obj = Anomaly_management(driver) keyword_obj.anomaly_keyword_detection() expected_title = "> Anomaly Keywords" element = driver.find_element_by_xpath( "//*[@id='content']/h2/span").text print(element) self.assertEqual(expected_title, element, "title is not Anomaly Keywords") driver.close() driver.quit()
def test(self): driver = webdriver.Chrome( executable_path= "C:/Users/kruthi.p/PycharmProjects/main/drivers/chromedriver.exe") driver.maximize_window() # Method that maximize the window print("started") driver.get(Utils.URL) # get the EOT_C Web URL from the Utils page login_obj = LoginPage(driver) # Object creation for loginpage class login_obj.Login( "*****@*****.**", "Sisa@123" ) # Function call to login method ;1st parameter = emailid ; 2nd parameter = password; keyword_obj = Anomaly_management(driver) keyword_obj.anomaly_keyword_detection() keyword_obj.AKM_add_keyword_button() time.sleep(3) keyword_obj.AKM_add_anomaly_keyword("Message", "Match", 111111, "kruthi1") expected_title = "Add New Keyword" time.sleep(3) element = driver.find_element_by_xpath("//*[@id='ui-id-1']").text print(element) self.assertEqual(expected_title, element, "title is not Add New Keyword") driver.close() driver.quit()
def test(self): driver = webdriver.Chrome(executable_path="C:/Users/kruthi.p/PycharmProjects/main/drivers/chromedriver.exe") driver.maximize_window() # Method that maximize the window print("started") driver.get(Utils.URL) # get the EOT_C Web URL from the Utils page login_obj = LoginPage(driver) # Object creation for loginpage class login_obj.Login("*****@*****.**","Sisa@123") # Function call to login method ;1st parameter = emailid ; 2nd parameter = password; keyword_obj = Anomaly_management(driver) keyword_obj.anomaly_keyword_detection() keyword_obj.AKM_add_keyword_button() keyword_obj.AKM_add_anomaly_keyword("Message","Match",2,"kruthi1") keyword_list=[] length = len(driver.find_elements_by_xpath("//*[@id='dt_basic']/tbody/tr")) #Checking the number of records exist in user list table print(length) # Validation: To check whether added user is present in list or not ; If present " User Added Successfully will be printed, If not Exception will be raised for i in range(1,length+1): rows = driver.find_element_by_xpath("//*[@id='dt_basic']/tbody/tr["+ str(i) +"]/td[6]").text keyword_list.append(rows) print(rows) var = "kruthi1" self.assertIn(var,keyword_list) driver.close() driver.quit()
def test(self): global rows_exist driver = webdriver.Chrome( executable_path= "C:/Users/kruthi.p/PycharmProjects/Test_Automation_Framework/drivers/chromedriver.exe" ) driver.maximize_window() # Method that maximize the window print("started") driver.get(Utils.URL) # get the EOT_C Web URL from the Utils page login_obj = LoginPage(driver) # Object creation for loginpage class login_obj.Login( "*****@*****.**", "Sisa@123" ) # Function call to login method ;1st parameter = emailid ; 2nd parameter = password; keyword_obj = Anomaly_management(driver) keyword_obj.anomaly_keyword_detection() keyword_before = [] keyword_after = [] length = len( driver.find_elements_by_xpath("//*[@id='dt_basic']/tbody/tr") ) # Checking the number of records exist in user list table print(length) value = 'rewfwef' for i in range(1, length + 1): rows = driver.find_element_by_xpath( "//*[@id='dt_basic']/tbody/tr[" + str(i) + "]/td[6]").text keyword_before.append(rows) #print(keyword_before) if value in keyword_before: # driver.find_element_by_xpath("//*[@id='dt_basic_filter']/label/input").click() # driver.find_element_by_xpath("//*[@id='dt_basic_filter']/label/input").send_keys("refeerf") time.sleep(3) keyword_obj.AKM_search("refeerf") keyword_obj.AKM_delete_particular() # Validation: To check whether added user is present in list or not ; If present " User Added Successfully will be printed, If not Exception will be raised length_post = len( driver.find_elements_by_xpath("//*[@id='dt_basic']/tbody/tr")) print(length_post) for i in range(1, length_post): rows_exist = driver.find_element_by_xpath( "//*[@id='dt_basic']/tbody/tr[" + str(i) + "]/td[6]").text keyword_after.append(rows_exist) print(keyword_after) self.assertIn( value, keyword_after ) # compares the value present in value with the user list driver.close() driver.quit()