Beispiel #1
0
    def test_purchase_behaviour_subcategory(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource(ds_type)
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Subcategory']").click()
        sleep(5)
        self.webdriver.find_element_by_xpath("//an-typeahead").click()
        sleep(5)
        try:
            self.webdriver.find_elements_by_xpath("//an-typeahead/div/ul/li")
            audience_page.aud_back_arrow().click()
        except NoSuchElementException:
            assert False
    def test_save_and_create_disable(self):
        project_name = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        audience_name = 'Test Aud'+my_random_string(3)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.audience_name_textbox().send_keys(audience_name)
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)
        sleep(5)
        audience_page.save_and_create_button().click()
        sleep(5)
        proj_page.audience_menu_icon(audience_name).click()
        proj_page.audienceEditIcon(audience_name)
        sleep(30)
        status = audience_page.save_and_create_button().get_attribute('disabled')
        self.assertEqual(status,'true','save and create disable feature not working')
        self.webdriver.find_element_by_css_selector(".back").click()

        proj_page.audience_menu_icon(audience_name).click()
        proj_page.audience_delete_icon(audience_name).click()
        proj_page.AlertOkButton().click()
Beispiel #3
0
    def test_create_purchase_data_audiences(self):

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects("Test_US_Automation")
        sleep(10)
        # Audience Creation using Advanced Audience Data
        proj_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Purchase_Audience')
        audience_page.add_dataSource('Purchase Behavior')
        criteria_label = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'header-label ng-binding ui-draggable-handle')]"
        ).text
        print(criteria_label)
        source = self.webdriver.find_element_by_xpath(
            "//div[contains(@class,'header-label ng-binding ui-draggable-handle') and contains(text(),'"
            + criteria_label + "')]")
        target = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'criteria-panel-header') and contains(text(),'Define Your Audience')]"
        )
        mouse = ActionChains(self.webdriver)
        mouse.drag_and_drop(source, target).perform()
        audience_page.create_purchase_data_criteria('Category',
                                                    'AIR FRESHENERS')
        # audience_page.add_criteria_plusicon().click()
        # audience_page.create_advanced_audience_data_criteria('In-Market Audiences', 'Beauty and Wellness', 'Personal Care', 'Hair Care')
        sleep(5)
        # self.webdriver.find_element_by_xpath("//div[contains(@class ,'text ng-binding') and contains(@ng-bind,'i.value')]").click()
        # sleep(5)
        # self.webdriver.find_element_by_xpath("//div[contains(@class ,'ng-binding ng-scope') and contains(text(),'OR')]").click()
        audience_page.save_and_create_button().click()
        sleep(10)
    def test_create_SSOA_FB_or_IG_Lotm(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'Affinity Audiences', 'Digital Engagement', 'Social Media',
            'Facebook')
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'Affinity Audiences', 'Digital Engagement', 'Social Media',
            'Instagram')

        list = self.webdriver.find_elements_by_xpath(
            "//div[contains(@class,'criteria-oper')]/div[text()='AND']")
        list[1].click()
        self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(country +
                                                        " SSOA - FB,IG - Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
Beispiel #5
0
    def test_purchase_behaviour_product_name(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource(ds_type)
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Product Name']").click()
        sleep(5)
        self.webdriver.find_element_by_xpath("//an-typeahead").click()
        sleep(5)
        list = self.webdriver.find_elements_by_xpath(
            "//an-typeahead/div/ul/li")
        p_name = ""
        for i in list:
            product_name = i.text
            if "category" in product_name:
                p_name = product_name

        self.assertEqual(p_name, "", "Product names list contain category")
    def test_create_SSOA_FB_and_IG_Lotm(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'Affinity Audiences', 'Digital Engagement', 'Social Media',
            'Facebook')
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'Affinity Audiences', 'Digital Engagement', 'Social Media',
            'Instagram')

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " SSAA - FB & IG - Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
Beispiel #7
0
    def test_create_MSAA_IG_or(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource('Browsing Behavior')
        audience_page.create_browsing_behaviour_domain_names('instagram.com')
        sleep(5)
        audience_page.add_dataSource('Advanced Audience Data')
        audience_page.create_advanced_audience_data_criteria(
            'Affinity Audiences', 'Digital Engagement', 'Social Media',
            'Instagram')
        list = self.webdriver.find_elements_by_xpath(
            "//div[contains(@class,'criteria-oper-groups')]/div[text()='AND']")
        list[1].click()
        self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " MSAA - IG - JS or Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
Beispiel #8
0
    def test_purchase_behaviour_category(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource(ds_type)
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        sleep(5)
        try:
            self.webdriver.find_element_by_xpath(
                "//input[@placeholder='Begin typing to search...']").click()
            self.webdriver.find_element_by_xpath(
                "//li[contains(text(),'AIR FRESHENERS')]").click()
            audience_page.aud_back_arrow().click()
        except NoSuchElementException:
            assert False
Beispiel #9
0
    def test_create_demographic_data_audiences(self):

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects("Test_US_Automation")
        sleep(10)
        # Audience Creation using Advanced Audience Data
        proj_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Demographic_Audience')
        audience_page.add_dataSource('Demographic Data')
        criteria_label = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'header-label ng-binding ui-draggable-handle')]"
        ).text
        print(criteria_label)
        source = self.webdriver.find_element_by_xpath(
            "//div[contains(@class,'header-label ng-binding ui-draggable-handle') and contains(text(),'"
            + criteria_label + "')]")
        target = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'criteria-panel-header') and contains(text(),'Define Your Audience')]"
        )
        mouse = ActionChains(self.webdriver)
        mouse.drag_and_drop(source, target).perform()
        audience_page.create_demographic_data_criteria('Age')
        sleep(5)
        # audience_page.save_and_create_button().click()
        sleep(10)
Beispiel #10
0
    def test_error_message_at_viz_canvas(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_and_create_button().click()
        sleep(10)
        project_page.AudienceName('Test Audience').click()
        message = self.webdriver.find_element_by_xpath("//div[@class='spinner-wrapper']//following::p[1]").text
        self.assertEqual(message,"Your audience is being built.","Incorrect message is getting displayed at Viz Canvas")

        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
Beispiel #11
0
    def test_distribution_icon_disabled(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_and_create_button().click()
        sleep(10)
        project_page.AudienceName('Test Audience').click()
        distribution_icon = project_page.audience_share_icon('Test Audience')
        if distribution_icon.is_enabled():
            print("Distribution Icon is disabled")
        else:
            print("Distribution Icon is not disabled")

        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
    def test_create_SSA_FB_or_IG_JS(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Browsing Behavior"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_browsing_behaviour_domain_names('facebook.com')

        audience_page.inner_criteria_plusIcon().click()
        audience_page.create_browsing_behaviour_domain_names('instagram.com')
        list = self.webdriver.find_elements_by_xpath(
            "//div[contains(@class,'criteria-oper')]/div[text()='AND']")
        list[1].click()
        self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(country +
                                                        " SSOA - FB,IG - JS")
        sleep(10)
        audience_page.save_and_create_button().click()
Beispiel #13
0
    def test_tag_at_history_panel(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath(
            "//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath(
            "//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]"
        )
        self.webdriver.execute_script("arguments[0].click();",
                                      criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_audience_button().click()
        sleep(10)

        project_page.AudienceName('Test Audience').click()
        project_page.HistoryTab().click()
        sleep(10)
        tag = self.webdriver.find_element_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul[1]/li[2]"
        ).text

        now = datetime.datetime.now()
        todays_date = now.strftime("%b %d, %Y").replace(' 0', ' ')
        date = self.webdriver.find_element_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul[1]/li[3]"
        ).text

        # Verify today's time with log time
        time = self.webdriver.find_element_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul[1]/li[4]"
        ).text
        tag_time_value = int(time[:-3].replace(":", ""))
        curr_time_value = int(now.strftime("%I") + now.strftime("%M"))

        assert (curr_time_value -
                tag_time_value) < 45, 'Time displayed in log seems incorrect'
        self.assertEqual(date, todays_date, "created tag date incorrect")
        self.assertEqual(tag, "Created", "created tag incorrect")

        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
    def test_create_audience(self):
        project_name = self.configAB["Lotame_Viz"]["project_name"]
        path = os.path.join('testdata', 'sidebar.json')
        print("location:" + path)

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)

        with open(path) as file:
            data = json.load(file)
        for item in range(len(data)):
            link = data[item]["link"]
            #Project Creation
            new_project_name = project_name + '_' + link
            print(new_project_name)
            proj_page.createProject(new_project_name, link)
            sleep(10)
            #Audience Creation
            proj_page.add_audience_button().click()
            sleep(5)
            audience_page.audience_name_textbox().send_keys('Any Travel')
            audience_page.add_dataSource('Advanced Audience Data')
            source = self.webdriver.find_element_by_xpath(
                "//div[contains(@class,'header-label ng-binding ui-draggable-handle') and contains(text(),'Advanced Audience Data Criteria')]"
            )
            target = self.webdriver.find_element_by_xpath(
                "//div[contains(@class, 'criteria-panel-header') and contains(text(),'Define Your Audience')]"
            )
            mouse = ActionChains(self.webdriver)
            mouse.drag_and_drop(source, target).perform()
            audience_page.create_advanced_audience_data_criteria(
                'Purchase History', 'Travel', 'Travel', 'Any  Air Travel')
            audience_page.add_criteria_plusicon().click()
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Travel', 'Travel', 'Any Travel')
            sleep(5)
            self.webdriver.find_element_by_xpath(
                "//div[contains(@class ,'text ng-binding') and contains(@ng-bind,'i.value')]"
            ).click()
            sleep(5)
            self.webdriver.find_element_by_xpath(
                "//div[contains(@class ,'ng-binding ng-scope') and contains(text(),'OR')]"
            ).click()

            audience_page.save_and_create_button().click()
            sleep(10)
            # Navigating to home screen
            self.webdriver.switch_to_default_content()
            home_page.lbl_Audience_Explorer_omni().click()
            sleep(10)
            iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
            self.webdriver.switch_to.frame(iframe)
            new_project_name = project_name
    def test_ssa(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'In-Market Audiences', 'Automotive & Vehicles', 'Cars', 'TRUE')

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " SSA-Auto In Market-Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
        ###############################################
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria_multiple_attribute_value(
            'In-Market Audiences',
            'Automotive & Vehicles',
            'Car Classifications',
            value=['Luxury SUV', 'Luxury Sedan'])

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " SSOA-Lux Auto In Market-Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
        ###############################################
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria_multiple_attribute_value(
            'In-Market Audiences',
            'Automotive & Vehicles',
            'Car Classifications',
            value=['Luxury SUV', 'Luxury Sedan'])
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria_multiple_attribute_value(
            'Purchase History',
            'Automotive & Vehicles',
            'Car Classifications',
            value=['Luxury SUV', 'Luxury Sedan'])

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " SSAA-Lux Auto InMarket & Own-Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
    def test_verify_agerange_starts_from_eighteen(self):
        project_name = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource("Demographic Data")
        sleep(5)
        audience_page.filter_col_dropdown().click()
        audience_page.webdriver.find_element_by_xpath("//option[text()='Age']").click()
        age_range = self.webdriver.find_element_by_xpath("//div[@class='criteria-edit-label slider-value-label']").text
        self.assertEqual(age_range, "Between 18 and 100", "Age range incorrect for demographic data")
    def test_verify_agerange_starts_from_eighteen_advance_audience(self):
        project_name    = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource("Advanced Audience Data")
        showing_age_list = audience_page.check_advance_age()
        print(showing_age_list)
        str =showing_age_list.replace("\n", "\t").replace("Age Range in Household - ","").replace("Age - Head of Household","")\
            .replace("Age - Input Individual","").replace("18-24","").replace("25-34","").replace("35-44","").replace("45-54","").replace("55-64","").replace("65-74","")\
            .replace("75+","").replace(" - Male","").replace(" - Female","").replace(" - Unknown Gender","").replace("-","").strip()

        self.assertEqual(str, "", "Age attributes are not correct")
    def test_audience_history_tag_title(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)
        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath(
            "//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath(
            "//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]"
        )
        self.webdriver.execute_script("arguments[0].click();",
                                      criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_audience_button().click()
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.AudienceName('Test Audience').click()
        project_page.HistoryTab().click()
        project_page.close_history().click()
        sleep(5)
        project_page.HistoryTab().click()

        list = self.webdriver.find_elements_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul/li[1]")

        for item in list:
            assert item.text == 'Test Audience'
        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
    def test_create_SSA_IG_JS(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Browsing Behavior"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_browsing_behaviour_domain_names('instagram.com')

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(country +
                                                        " SSA - IG - JS")
        sleep(10)
        audience_page.save_and_create_button().click()
    def test_population_female(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'Demographics', 'Gender', 'Female', 'TRUE')

        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(country +
                                                        " Population Female")
        sleep(5)
        audience_page.save_and_create_button().click()
    def test_compare_trigger_disabled_single_audience(self):
        new_project_name = self.configAB["CreateProject"]["new_project_name"]
        data_env = self.configAB["CreateProject"]["data_env"]

        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        proj_page = ProjectPage(self.webdriver, self.config)

        home_page.searchProjects(new_project_name)
        string = my_random_string(3)
        new_project_name = new_project_name + string
        proj_page.createProject(new_project_name, data_env)
        sleep(10)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath(
            "//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath(
            "//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]"
        )
        self.webdriver.execute_script("arguments[0].click();",
                                      criteria_createButton)
        sleep(5)
        audience_page.save_audience_button().click()
        element = WebDriverWait(self.webdriver, 50).until(
            EC.visibility_of_element_located(
                (By.CSS_SELECTOR, ".compare-trigger")))
        trigger = element.get_attribute("class")

        self.assertEqual(trigger, "compare-trigger disabled",
                         "Compare trigger is not disabled")
        proj_page.deleteProject(new_project_name)
Beispiel #22
0
    def test_create_advance_data_audiences(self):
        # project_name = self.configAB["Lotame_Viz"]["project_name"]
        # path = os.path.join('testdata', 'sidebar.json')
        # print("location:" + path)

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects("Test_US_Automation")
        sleep(10)
        # Audience Creation using Advanced Audience Data
        proj_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Advance_Audience')
        audience_page.add_dataSource('Advanced Audience Data')
        source = self.webdriver.find_element_by_xpath(
            "//div[contains(@class,'header-label ng-binding ui-draggable-handle') and contains(text(),'Advanced Audience Data Criteria')]"
        )
        target = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'criteria-panel-header') and contains(text(),'Define Your Audience')]"
        )
        mouse = ActionChains(self.webdriver)
        mouse.drag_and_drop(source, target).perform()
        audience_page.create_advanced_audience_data_criteria(
            'Food', 'Diet', 'Vegan', '3 Average')
        audience_page.add_criteria_plusicon().click()
        audience_page.create_advanced_audience_data_criteria(
            'Demographic', 'Education', 'Education - Head of Household',
            'Completed College')
        sleep(5)
        self.webdriver.find_element_by_xpath(
            "//div[contains(@class ,'text ng-binding') and contains(@ng-bind,'i.value')]"
        ).click()
        sleep(5)
        self.webdriver.find_element_by_xpath(
            "//div[contains(@class ,'ng-binding ng-scope') and contains(text(),'OR')]"
        ).click()
        audience_page.save_and_create_button().click()
        sleep(10)
Beispiel #23
0
    def test_create_MSSA_IG_and(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource('Browsing Behavior')
        audience_page.create_browsing_behaviour_domain_names('instagram.com')
        sleep(5)
        audience_page.add_dataSource('Advanced Audience Data')
        audience_page.create_advanced_audience_data_criteria(
            'Affinity Audiences', 'Digital Engagement', 'Social Media',
            'Instagram')
        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " MSOA - IG - JS and Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
Beispiel #24
0
    def test_purchase_behaviour(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        sleep(5)
        cols = self.webdriver.find_elements_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]/option")
        col = ""
        for i in cols:
            col = i.text + col

        print(col)
        self.assertEqual(col, "QuintileProduct NameSubcategoryCategory",
                         "Purchase behaviour column list incorrect")
    def test_MSOA_MSAA(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        # proj_page.add_audience_button().click()
        #
        # audience_page = AudiencePage(self.webdriver, self.config)
        # audience_page.add_dataSource(ds_type)
        # audience_page.create_advanced_audience_data_criteria_multiple_attribute_value('In-Market Audiences', 'Automotive & Vehicles', 'Car Classifications', value=['Luxury SUV', 'Luxury Sedan'])
        # audience_page.add_dataSource(ds_type)
        # audience_page.create_browsing_behaviour_domain_names_multiple(name=['acura.com', 'lexus.com', 'bmw.com'])
        # audience_page.add_dataSource(ds_type)
        # audience_page.create_browsing_behaviour_domain_names_multiple(name=['acura.com', 'lexus.com', 'bmw.com'])
        # audience_page.audience_name_textbox().clear()
        # audience_page.audience_name_textbox().send_keys(country + " MSOA-Lux Auto-JS or Lotm")
        # sleep(5)
        # audience_page.save_and_create_button().click()
        # ###############################################
        sleep(5)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        audience_page.create_advanced_audience_data_criteria(
            'Demographics', 'Number of Children', '1 OR MORE', 'TRUE')
        audience_page.add_dataSource('Browsing Behavior')
        audience_page.create_browsing_behaviour_domain_names_multiple(
            name=['acura.com', 'lexus.com', 'bmw.com'])
        # audience_page.add_dataSource(ds_type)
        # audience_page.create_browsing_behaviour_domain_names_multiple(name=['acura.com', 'lexus.com', 'bmw.com'])
        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " MSAA-Lux Auto w  Kids-JS or Lotm")
        sleep(5)
        audience_page.save_and_create_button().click()
    def test_create_ssa_any_social_js(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Browsing Behavior"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        # audience_page.create_browsing_behaviour_domain_categories_multiple_sub_category('Social Media',sub_category=['Blogs','Social Networking'])
        audience_page.create_browsing_behaviour_domain_categories_single_sub_category(
            'Social Media', 'Blogs')
        audience_page.add_dataSource(ds_type)
        audience_page.create_browsing_behaviour_domain_categories_single_sub_category(
            'Social Media', 'Social Networking')
        audience_page.audience_name_textbox().clear()
        audience_page.audience_name_textbox().send_keys(
            country + " SSA - Any Social - JS")
        sleep(10)
        audience_page.save_and_create_button().click()
    def test_create_audience_population(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        for age_range in ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']:
            proj_page = ProjectPage(self.webdriver, self.config)
            proj_page.add_audience_button().click()

            audience_page = AudiencePage(self.webdriver, self.config)
            audience_page.add_dataSource(ds_type)
            # audience_page.create_advanced_audience_data_criteria('Demographics', 'Age', age_range, 'TRUE')
            audience_page.create_advanced_audience_data_criteria(
                'Demographics', 'Age', 'Age Group', age_range)

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country +
                                                            " Population " +
                                                            age_range)
            sleep(5)
            audience_page.save_and_create_button().click()
    def test_save_and_create_audience_button(self):
        project_name = self.configAB["Save_Create_button_audiences"]["project_name"]
        audience_name = self.configAB["Save_Create_button_audiences"]["audience_name"]
        omni_username = self.configAB["AELogin"]["username"]
        # omni_password         = self.configAB["AELogin"]["password"]
        shared_username = self.configAB["Save_Create_button_audiences"]["shared_userid"]
        shared_password = self.configAB["Save_Create_button_audiences"]["shared_pwd"]
        # category = self.configAB["Save_Create_button_audiences"]["category"]
        # sub_category = self.configAB["Save_Create_button_audiences"]["sub_category"]

        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)
        sleep(10)
        user_owner = audience_page.lbl_User().text
        print("This is the owner of this project " + user_owner)
        sleep(10)
        omni_first_name = omni_username.split('.')[0]
        print("This is the first name " + omni_first_name)
        omni_last_name = omni_username.split('.')[1]
        print("This is the last name " + omni_last_name)
        omni_owner = omni_first_name + " " + omni_last_name
        print("This is the omni_owner name " + omni_owner)
        # if user_owner == omni_username:
        btn_saveaud = audience_page.save_audience_button().is_enabled()
        print(btn_saveaud)
        self.assertIs(btn_saveaud, True)
        btn_savencreate = audience_page.save_and_create_button().is_enabled()
        print(btn_savencreate)
        self.assertIs(btn_savencreate, True)
        audience_page.add_criteria_plusicon().click()
        # audience_page.create_browsing_behaviour_domain_categories(category, sub_category)

        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)

        self.assertIs(btn_saveaud, True)
        self.assertIs(btn_savencreate, True)

        sleep(10)
        self.webdriver.switch_to_default_content()
        # actions = ActionChains(self.webdriver)
        # actions.move_to_element(project_page.img_profile()).perform()
        home_page.img_profile().click()
        sleep(5)
        home_page.link_signout().click()
        sleep(15)
        login_page = LoginPage(self.webdriver, self.config)
        login_page.login(shared_username, shared_password)
        sleep(15)
        WebDriverWait(self.webdriver, 100).until(EC.visibility_of_element_located((By.XPATH, "//button[@class='header_nav_btn']"))).click()

        sleep(5)
        # try:
        #     WebDriverWait(self.webdriver, 100).until(EC.presence_of_element_located((By.XPATH, "//a[text()='Clients']"))).click()
        #     sleep(5)
        #     WebDriverWait(self.webdriver, 100).until(EC.presence_of_element_located((By.XPATH, "//span[contains(text(),'OMNI Demo') or contains(text(),'Omni Demo')]"))).click()
        #     sleep(5)
        #     WebDriverWait(self.webdriver, 100).until(EC.presence_of_element_located((By.XPATH, "//button[@class='header_nav_btn']"))).click()
        #     sleep(5)
        # except:
        #     pass
        WebDriverWait(self.webdriver, 100).until(EC.visibility_of_element_located((By.XPATH, "//span[text()='Audience Explorer (Omni)']"))).click()
        sleep(5)
        iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
        self.webdriver.switch_to.frame(iframe)

        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)
        sleep(10)
        user_owner = audience_page.lbl_User().text
        print("This is the owner of this project " + user_owner)
        sleep(10)
        shared_omni_first_name = shared_username.split('.')[0]
        print("This is the shared first name " + shared_omni_first_name)
        shared_omni_last_name = shared_username.split('.')[1]
        print("This is the shared last name " + shared_omni_last_name)
        shared_omni_owner = shared_omni_first_name + " " + shared_omni_last_name
        print("This is the shared omni_owner name " + shared_omni_owner)
        # if user_owner == omni_username:
        btn_saveaud = audience_page.save_audience_button().is_enabled()
        print(btn_saveaud)
        self.assertIs(btn_saveaud, False)
        btn_savencreate = audience_page.save_and_create_button().is_enabled()
        print(btn_savencreate)
        self.assertIs(btn_savencreate, False)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_criteria_plusicon().click()
        # audience_page.create_browsing_behaviour_domain_categories(category, sub_category)

        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)

        self.assertIs(btn_saveaud, False)
        self.assertIs(btn_savencreate, False)

    # def test_verify_agerange_starts_from_eighteen_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     project_page.add_audience_button().click()
    #     sleep(10)
    #     # Adding Criteria
    #     audience_page.add_dataSource("Demographic Data")
    #     sleep(5)
    #     audience_page.filter_col_dropdown().click()
    #     audience_page.webdriver.find_element_by_xpath("//option[text()='Age']").click()
    #     age_range = self.webdriver.find_element_by_xpath("//div[@class='criteria-edit-label slider-value-label']").text
    #     self.assertEqual(age_range, "Between 18 and 100", "Age range incorrect for demographic data")
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    #
    # def test_verify_agerange_starts_from_eighteen_advance_audience_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     # Adding Criteria
    #     project_page.add_audience_button().click()
    #     sleep(10)
    #     audience_page.add_dataSource("Advanced Audience Data")
    #     showing_age_list = audience_page.check_advance_age()
    #     str =showing_age_list.replace("\n", "\t").replace("Age Range in Household - ","").replace("Age - Head of Household","")\
    #         .replace("Age - Input Individual","").replace("18-24","").replace("25-34","").replace("35-44","").replace("45-54","").replace("55-64","").replace("65-74","")\
    #         .replace("75+","").replace(" - Male","").replace(" - Female","").replace(" - Unknown Gender","").replace("-","").strip()
    #
    #     self.assertEqual(str, "", "Age attributes are not correct")
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    #
    # def test_saved_audience_timestamp_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     project_name = 'Test Proj' + rand
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     # Adding Criteria
    #     project_page.add_audience_button().click()
    #     sleep(10)
    #     audience_page.audience_name_textbox().send_keys('Test Audience1')
    #     audience_page.add_dataSource('Browsing Behavior')
    #     audience_page.create_browsing_behaviour_domain_names('facebook.com')
    #     audience_page.save_audience_button().click()
    #     sleep(5)
    #     self.webdriver.switch_to_default_content()
    #     home_page.lbl_Audience_Explorer_omni().click()
    #     sleep(20)
    #     iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
    #     self.webdriver.switch_to.frame(iframe)
    #     home_page.searchProjects(project_name)
    #     sleep(5)
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     actual_timestamp = self.webdriver.find_element_by_xpath("//div[contains(@class,'edit-when ng-scope')]").text
    #     # print("This is the actual timestamp " + actual_timestamp)
    #     date_time = audience_page.lbl_date_time().text
    #     user = audience_page.lbl_User().text
    #     data_env = audience_page.lbl_data_env().text
    #     expected_timestamp = "Last Saved" + " " + date_time + " By " + user + " " + data_env
    #     assert actual_timestamp.startswith("Last Saved")
    #     self.assertEqual(actual_timestamp, expected_timestamp)
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    #
    # def test_time_period_criteria_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     project_name = 'Test Proj' + rand
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     # Adding Criteria
    #     project_page.add_audience_button().click()
    #     time_period = audience_page.get_time_period().text
    #     self.assertEqual(time_period, "Q2 2019", "Default Time period incorrect")
    #
    #     audience_page.click_edit_time_period().click()
    #     sleep(5)
    #     time_period_list = self.webdriver.find_element_by_xpath(
    #         "//div[text()='Select Quarter*']/following::select[contains(@ng-model,'selectedTimePeriodsNew')]/option[contains(@value,'object')]").text
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    #
    # def test_save_and_create_disable_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     # Audience Creation
    #     project_page.add_audience_button().click()
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     audience_page.audience_name_textbox().send_keys('Test Audience1')
    #     audience_page.add_dataSource('Browsing Behavior')
    #     audience_page.create_browsing_behaviour_domain_names('facebook.com')
    #     audience_page.save_and_create_button().click()
    #     sleep(5)
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     status = audience_page.save_and_create_button().get_attribute('disabled')
    #     self.assertEqual(status,'true','save and create disable feature not working')
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    #
    # def test_verify_Quarter_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     project_name = 'Test Proj' + rand
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     # Audience Creation
    #     project_page.add_audience_button().click()
    #     audience_page.audience_name_textbox().send_keys('Test Audience1')
    #     audience_page.add_dataSource('Browsing Behavior')
    #     audience_page.create_browsing_behaviour_domain_names('facebook.com')
    #     audience_page.save_and_create_button().click()
    #     sleep(10)
    #     self.webdriver.switch_to_default_content()
    #     home_page.lbl_Audience_Explorer_omni().click()
    #     sleep(5)
    #     iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
    #     self.webdriver.switch_to.frame(iframe)
    #     home_page.searchProjects(project_name)
    #     sleep(5)
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     sleep(10)
    #     data_env = audience_page.lbl_data_env().text
    #     #print("This is the value of data environment " + data_env)
    #     quarter_time = audience_page.Time_Period().text
    #     #print("This is the time period " + quarter_time)
    #     self.assertIn(quarter_time, data_env)
    #     audience_page.Time_Period_Edit().click()
    #     drp_quarter = audience_page.drp_Quarter()
    #     dd_quarter = Select(drp_quarter)
    #     dd_quarter.select_by_visible_text("Q2 2019")
    #     audience_page.btn_quarter_create().click()
    #     audience_page.save_audience_button().click()
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     self.assertIn(quarter_time, data_env)
    #     sleep(10)
    #     data_env = audience_page.lbl_data_env().text
    #     #print("This is the value of data environement " + data_env)
    #     quarter_time = audience_page.Time_Period().text
    #     #print("This is the time period " + quarter_time)
    #     self.assertIn(quarter_time, data_env)
    #     audience_page.Time_Period_Edit().click()
    #     drp_quarter = audience_page.drp_Quarter()
    #     dd_quarter = Select(drp_quarter)
    #     dd_quarter.select_by_visible_text("Q1 2019")
    #     audience_page.btn_quarter_create().click()
    #     audience_page.save_audience_button().click()
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     self.assertIn(quarter_time, data_env)
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    #
    # def test_save_and_create_audience_button_on_the_fly(self):
    #     rand = my_random_string(3)
    #     home_page = HomePage(self.webdriver, self.config)
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     project_name = 'Test Proj' + rand
    #     omni_username = self.configAB["AELogin"]["username"]
    #     shared_username = '******'
    #     shared_password = '******'
    #     # Project Creation
    #     home_page.createProject('Test Proj' + rand, 'NA - United States')
    #     sleep(10)
    #     # Audience Creation
    #     project_page.add_audience_button().click()
    #     audience_page.audience_name_textbox().send_keys('Test Audience1')
    #     audience_page.add_dataSource('Browsing Behavior')
    #     audience_page.create_browsing_behaviour_domain_names('facebook.com')
    #     audience_page.save_and_create_button().click()
    #     sleep(10)
    #     self.webdriver.switch_to_default_content()
    #     home_page.lbl_Audience_Explorer_omni().click()
    #     sleep(5)
    #     iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
    #     self.webdriver.switch_to.frame(iframe)
    #     home_page.searchProjects(project_name)
    #     sleep(5)
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     sleep(10)
    #     user_owner = audience_page.lbl_User().text
    #     print("This is the owner of this project " + user_owner)
    #     sleep(10)
    #     omni_first_name = omni_username.split('.')[0]
    #     print("This is the first name " + omni_first_name)
    #     omni_last_name = omni_username.split('.')[1]
    #     print("This is the last name " + omni_last_name)
    #     omni_owner = omni_first_name + " " + omni_last_name
    #     print("This is the omni_owner name " + omni_owner)
    #     # if user_owner == omni_username:
    #     btn_saveaud = audience_page.save_audience_button().is_enabled()
    #     print(btn_saveaud)
    #     self.assertIs(btn_saveaud, True)
    #     btn_savencreate = audience_page.save_and_create_button().is_enabled()
    #     print(btn_savencreate)
    #     self.assertIs(btn_savencreate, True)
    #     audience_page.add_criteria_plusicon().click()
    #     audience_page.create_browsing_behaviour_domain_names('facebook.com')
    #     self.assertIs(btn_saveaud, True)
    #     self.assertIs(btn_savencreate, True)
    #
    #     sleep(10)
    #     self.webdriver.switch_to_default_content()
    #     # actions = ActionChains(self.webdriver)
    #     # actions.move_to_element(project_page.img_profile()).perform()
    #     home_page.img_profile().click()
    #     sleep(5)
    #     home_page.link_signout().click()
    #     sleep(15)
    #     login_page = LoginPage(self.webdriver, self.config)
    #     login_page.login(shared_username, shared_password)
    #     sleep(15)
    #     WebDriverWait(self.webdriver, 100).until(EC.visibility_of_element_located((By.XPATH, "//button[@class='header_nav_btn']"))).click()
    #
    #     sleep(5)
    #     # try:
    #     #     WebDriverWait(self.webdriver, 100).until(EC.presence_of_element_located((By.XPATH, "//a[text()='Clients']"))).click()
    #     #     sleep(5)
    #     #     WebDriverWait(self.webdriver, 100).until(EC.presence_of_element_located((By.XPATH, "//span[contains(text(),'OMNI Demo') or contains(text(),'Omni Demo')]"))).click()
    #     #     sleep(5)
    #     #     WebDriverWait(self.webdriver, 100).until(EC.presence_of_element_located((By.XPATH, "//button[@class='header_nav_btn']"))).click()
    #     #     sleep(5)
    #     # except:
    #     #     pass
    #     WebDriverWait(self.webdriver, 100).until(EC.visibility_of_element_located((By.XPATH, "//span[text()='Audience Explorer (Omni)']"))).click()
    #     sleep(5)
    #     iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
    #     self.webdriver.switch_to.frame(iframe)
    #
    #     home_page.searchProjects(project_name)
    #
    #     project_page = ProjectPage(self.webdriver, self.config)
    #     project_page.audience_menu_icon('Test Audience1').click()
    #     project_page.audienceEditIcon('Test Audience1')
    #     sleep(10)
    #     user_owner = audience_page.lbl_User().text
    #     print("This is the owner of this project " + user_owner)
    #     sleep(10)
    #     shared_omni_first_name = shared_username.split('.')[0]
    #     print("This is the shared first name " + shared_omni_first_name)
    #     shared_omni_last_name = shared_username.split('.')[1]
    #     print("This is the shared last name " + shared_omni_last_name)
    #     shared_omni_owner = shared_omni_first_name + " " + shared_omni_last_name
    #     print("This is the shared omni_owner name " + shared_omni_owner)
    #     # if user_owner == omni_username:
    #     btn_saveaud = audience_page.save_audience_button().is_enabled()
    #     print(btn_saveaud)
    #     self.assertIs(btn_saveaud, False)
    #     btn_savencreate = audience_page.save_and_create_button().is_enabled()
    #     print(btn_savencreate)
    #     self.assertIs(btn_savencreate, False)
    #     audience_page = AudiencePage(self.webdriver, self.config)
    #     audience_page.add_criteria_plusicon().click()
    #     audience_page.create_browsing_behaviour_domain_names('facebook.com')
    #     self.assertIs(btn_saveaud, False)
    #     self.assertIs(btn_savencreate, False)
    #     # Deleting Project
    #     audience_page.aud_back_arrow().click()
    #     project_page.project_menu_icon('Test Proj' + rand).click()
    #     project_page.project_delete_icon('Test Proj' + rand).click()
    #     project_page.AlertOkButton().click()
    def test_all(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Browsing Behavior"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        audience_page = AudiencePage(self.webdriver, self.config)
        try:
            audience_page.add_dataSource(ds_type)
            # audience_page.create_browsing_behaviour_domain_categories_multiple_sub_category('Social Media',sub_category=['Blogs','Social Networking'])
            audience_page.create_browsing_behaviour_domain_categories_single_sub_category(
                'Social Media', 'Blogs')
            audience_page.add_dataSource(ds_type)
            audience_page.create_browsing_behaviour_domain_categories_single_sub_category(
                'Social Media', 'Social Networking')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSA - Any Social - JS")
            sleep(10)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA - Any Social - JS")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_browsing_behaviour_domain_names(
                'facebook.com')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country +
                                                            " SSA - FB - JS")
            sleep(10)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA - FB - JS")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_browsing_behaviour_domain_names(
                'instagram.com')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country +
                                                            " SSA - IG - JS")
            sleep(10)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA - IG - JS")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_browsing_behaviour_domain_names(
                'facebook.com')

            audience_page.inner_criteria_plusIcon().click()
            audience_page.create_browsing_behaviour_domain_names(
                'instagram.com')
            list = self.webdriver.find_elements_by_xpath(
                "//div[contains(@class,'criteria-oper')]/div[text()='AND']")
            list[1].click()
            self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSOA - FB,IG - JS")
            sleep(10)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSOA - FB,IG - JS")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_browsing_behaviour_domain_names(
                'facebook.com')

            audience_page.add_dataSource(ds_type)
            audience_page.create_browsing_behaviour_domain_names(
                'instagram.com')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSAA - FB & IG - JS")
            sleep(10)
            audience_page.save_and_create_button().click()

        except Exception as e:
            print(e, country + " SSAA - FB & IG - JS")
            audience_page.aud_back_arrow().click()

        ######################Lotame#######################

        ###################################################

        ds_type = "Advanced Audience Data"
        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'In-Market Audiences', 'Automotive & Vehicles', 'Cars', 'TRUE')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSA-Auto In Market-Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
            ###############################################
        except Exception as e:
            print(e, country + " SSA-Auto In Market-Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria_multiple_attribute_value(
                'In-Market Audiences',
                'Automotive & Vehicles',
                'Car Classifications',
                value=['Luxury SUV', 'Luxury Sedan'])

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSOA-Lux Auto In Market-Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSOA-Lux Auto In Market-Lotm")
            audience_page.aud_back_arrow().click()
            ###############################################
        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria_multiple_attribute_value(
                'In-Market Audiences',
                'Automotive & Vehicles',
                'Car Classifications',
                value=['Luxury SUV', 'Luxury Sedan'])
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria_multiple_attribute_value(
                'Purchase History',
                'Automotive & Vehicles',
                'Car Classifications',
                value=['Luxury SUV', 'Luxury Sedan'])

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSAA-Lux Auto InMarket & Own-Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSAA-Lux Auto InMarket & Own-Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Any Social Media')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSA Any Social - Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA Any Social - Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Demographics', 'Gender', 'Male', 'TRUE')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country +
                                                            " Population Male")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " Population Male")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Demographics', 'Gender', 'Female', 'TRUE')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " Population Female")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " Population Female")
            audience_page.aud_back_arrow().click()

        ######################################

        for age_range in ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']:
            try:
                proj_page = ProjectPage(self.webdriver, self.config)
                proj_page.add_audience_button().click()

                audience_page.add_dataSource(ds_type)
                # audience_page.create_advanced_audience_data_criteria('Demographics', 'Age', age_range, 'TRUE')
                audience_page.create_advanced_audience_data_criteria(
                    'Demographics', 'Age', 'Age Group', age_range)

                audience_page.audience_name_textbox().clear()
                audience_page.audience_name_textbox().send_keys(
                    country + " Population " + age_range)
                sleep(5)
                audience_page.save_and_create_button().click()
            except Exception as e:
                print(e, country + " Population " + age_range)
                audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Facebook')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country +
                                                            " SSA - FB - Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA - FB - Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Instagram')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country +
                                                            " SSA - IG - Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA - IG - Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Facebook')
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Instagram')

            list = self.webdriver.find_elements_by_xpath(
                "//div[contains(@class,'criteria-oper')]/div[text()='AND']")
            list[1].click()
            self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSOA - FB,IG - Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSOA - FB,IG - Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Facebook')
            audience_page.add_dataSource(ds_type)
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Instagram')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " SSAA - FB & IG - Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSAA - FB & IG - Lotm")
            audience_page.aud_back_arrow().click()

        #################################################

        ##################jumpshot-lotame################

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_names(
                'facebook.com')

            sleep(5)
            audience_page.add_dataSource('Advanced Audience Data')
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Facebook')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " MSSA - FB - JS and Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " MSSA - FB - JS and Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_names(
                'instagram.com')
            sleep(5)
            audience_page.add_dataSource('Advanced Audience Data')
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Instagram')
            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " MSAA - IG - JS and Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " MSAA - IG - JS and Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_names(
                'facebook.com')
            sleep(5)
            audience_page.add_dataSource('Advanced Audience Data')
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Facebook')
            list = self.webdriver.find_elements_by_xpath(
                "//div[contains(@class,'criteria-oper-groups')]/div[text()='AND']"
            )
            list[1].click()
            self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " MSOA - FB - JS or Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " MSOA - FB - JS or Lotm")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_names(
                'instagram.com')
            sleep(5)
            audience_page.add_dataSource('Advanced Audience Data')
            audience_page.create_advanced_audience_data_criteria(
                'Affinity Audiences', 'Digital Engagement', 'Social Media',
                'Instagram')
            list = self.webdriver.find_elements_by_xpath(
                "//div[contains(@class,'criteria-oper-groups')]/div[text()='AND']"
            )
            list[1].click()
            self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(
                country + " MSOA - IG - JS or Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " MSOA - IG - JS or Lotm")
            audience_page.aud_back_arrow().click()
    def test_prod_aud(self):
        country = self.configAB["Conceptual"]["country"]
        project_name = self.configAB["Conceptual"]["project_name"]
        ds_type = "Advanced Audience Data"

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)


        try:
            proj_page = ProjectPage(self.webdriver, self.config)
            proj_page.add_audience_button().click()

            audience_page.add_dataSource(ds_type)
            # audience_page.create_advanced_audience_data_criteria('Demographics', 'Age', age_range, 'TRUE')
            audience_page.create_advanced_audience_data_criteria('Demographics', 'Age', 'Age Group', '18-24')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country + " Population " + '18-24')
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " Population " + '18-24')
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            # audience_page.create_browsing_behaviour_domain_categories_multiple_sub_category('Social Media',sub_category=['Blogs','Social Networking'])
            audience_page.create_browsing_behaviour_domain_categories_single_sub_category('Social Media', 'Blogs')
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_categories_single_sub_category('Social Media', 'Social Networking')

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country + " SSA - Any Social - JS")
            sleep(10)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSA - Any Social - JS")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_names('facebook.com')

            audience_page.inner_criteria_plusIcon().click()
            audience_page.create_browsing_behaviour_domain_names('instagram.com')
            list = self.webdriver.find_elements_by_xpath("//div[contains(@class,'criteria-oper')]/div[text()='AND']")
            list[1].click()
            self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country + " SSOA - FB,IG - JS")
            sleep(10)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " SSOA - FB,IG - JS")
            audience_page.aud_back_arrow().click()

        try:
            proj_page.add_audience_button().click()
            audience_page.add_dataSource('Browsing Behavior')
            audience_page.create_browsing_behaviour_domain_names('facebook.com')
            sleep(5)
            audience_page.add_dataSource('Advanced Audience Data')
            audience_page.create_advanced_audience_data_criteria('Affinity Audiences', 'Digital Engagement', 'Social Media',
                                                                 'Facebook')
            list = self.webdriver.find_elements_by_xpath("//div[contains(@class,'criteria-oper-groups')]/div[text()='AND']")
            list[1].click()
            self.webdriver.find_element_by_xpath("//div[text()='OR']").click()

            audience_page.audience_name_textbox().clear()
            audience_page.audience_name_textbox().send_keys(country + " MSOA - FB - JS or Lotm")
            sleep(5)
            audience_page.save_and_create_button().click()
        except Exception as e:
            print(e, country + " MSOA - FB - JS or Lotm")
            audience_page.aud_back_arrow().click()