Esempio n. 1
0
class Google_Calendar_Setting_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.google_calendar_setting_func = Google_Calendar_Setting(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        # GuildPress一般設定登録ページへ移動する
        self.go_to_guild_press_setting_page()

        # Googleカレンダー設定登録ページへ移動する
        self.google_calendar_setting_func.go_to_google_calendar_setting_page()

        # Googleカレンダーの設定とかを入力する。
        self.google_calendar_setting_func.put_google_calendar_setting_info()

        #GoogleカレンダーAPIを設定する。
        self.google_calendar_setting_func.set_google_calendar_api()

        #トップページへ戻る
        self.go_to_admin_top_page()

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_guild_press_setting_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_settings_page_path = self.admin_xpath_lists[
            'admin_guild_press_settings_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path, admin_guild_press_settings_page_path)
Esempio n. 2
0
class Many_Lesson_Detail_Posts_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.many_lesson_detail_posts_func = Many_Lesson_Detail_Posts(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):

        #GuildPress各レッスン登録一覧新規追加ページへ移動
        self.go_to_add_new_lesson_overview_page()

        # #レッスンの概要を詰める
        self.many_lesson_detail_posts_func.add_lesson_detail_page()

        # #トップページへ戻る
        self.go_to_admin_top_page()

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_add_new_lesson_overview_page(self):
        admin_guild_press_lesson_detail_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_page_path']
        admin_guild_press_lesson_detail_list_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_list_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_lesson_detail_page_path,
            admin_guild_press_lesson_detail_list_page_path)
class Original_Form_Controller:

	def __init__(self, driver, target_url):
		self.chrome = driver
		self.target_url = target_url

		self.admin_xpath_list_func = Admin_Menu_Path()
		self.basic_func = Basic()
		self.driver_action_func = Driver_Action( driver )
		self.create_original_form_func = Create_Original_Form( driver )

		# 管理画面のメニューのパスを返す
		self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath()

		# 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
		self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath()

	def start( self ):

		#GuildPressユーザー登録フォーム項目に移動。
		self.go_to_guild_press_original_register_form()

		#ユーザー登録フォームでオリジナルの項目を登録する、
		self.create_original_form_func.add_original_form_inputs()

		#トップページへ戻る
		self.go_to_admin_top_page()


	def go_to_admin_top_page(self):
		self.driver_action_func.move_to_page_by_link( self.chrome, self.target_url + 'wp-admin/' )

	def go_to_guild_press_original_register_form( self ):
		admin_guild_press_page_path = self.admin_xpath_lists['admin_guild_press_page_path']
		admin_guild_press_original_form_page_path = self.admin_xpath_lists['admin_guild_press_original_form_page_path']

		self.driver_action_func.move_admin_page( admin_guild_press_page_path, admin_guild_press_original_form_page_path )
class PayPal_User_Register_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.paypal_add_new_func = Pay_Pal_Add_New_One(driver)
        self.paypal_carete_page_func = Pay_Pal_Create_Page(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        #PayPal設定ページに移動
        self.go_to_paypal_setting_page()

        #PayPalボタン作成画面に移動
        self.paypal_add_new_func.go_to_pay_pal_register_page()
        #継続課金のボタン作成
        self.paypal_add_new_func.add_normal_subscription_payment()

        payapl_short_code = self.paypal_carete_page_func.get_new_pay_pal_short_code(
        )

        #固定ページ一覧に移動
        self.go_to_page_list()

        #新規追加ページへ移動
        self.driver_action_func.go_to_add_new_page()

        #ペイパルのページを作成
        self.paypal_carete_page_func.create_normal_subscription_page(
            payapl_short_code)

        #公開ボタンをクリックする。
        self.driver_action_func.click_publish_btn()

        #ペイパルのテスト
        self.test_pay_pal_regsiter()

        #トップページへ移動
        self.go_to_admin_top_page()

    def test_pay_pal_regsiter(self):

        paypal_page_link = self.driver_action_func.edit_page_link()

        new_paypal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_paypal_register_driver.get(paypal_page_link)

        # 新しいブラウザでインスタンス作成
        paypal_register_func = Test_User_Normal_Register(
            new_paypal_register_driver)
        paypal_register_func.nomarl_put_user_info_to_form()

        payment_register_func = Test_User_Payment_Register(
            new_paypal_register_driver)
        payment_register_func.click_register_page_pay_pal_btn()
        #payment_register_func.click_new_register_page_pay_pal_btn()

        self.driver_action_func.quit(new_paypal_register_driver)

    def go_to_paypal_setting_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_paypal_page_path = self.admin_xpath_lists[
            'admin_guild_press_paypal_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path, admin_guild_press_paypal_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)
Esempio n. 5
0
class Member_Rank_OverView_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.admin_member_rank_func = Admin_Member_Rank(driver)
        self.user_register_func = User_Register_Setting(driver)
        self.paypal_add_new_func = Pay_Pal_Add_New_One(driver)
        self.paypal_carete_page_func = Pay_Pal_Create_Page(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        #固定ページ一覧に移動
        self.go_to_member_rank_page()

        #会員ランクを設定していく
        self.admin_member_rank_func.add_admin_rank()

        ##レッスン概要ページにブロックを設定する。
        #GuildPressレッスン一覧新規追加ページへ移動
        self.go_to_lesson_over_view_page()

        #会員ランクのブロックを追加していく。
        self.admin_member_rank_func.add_block_setting_overview_page()

        ##別のタブを立ち上げて、普通にユーザー登録をして、表示を確認する。
        self.check_block_page_by_normal_regsiter()

        ##今度はゴールド会員として登録して表示をチェックするためにゴールド会員のページを作成
        self.check_block_page_by_paypal_regsiter()

        #トップページへ戻る
        self.go_to_admin_top_page()

        ##一連のチェックを終えたら、ページのブロックを解除する。
        self.reset_block_page()

        #トップページへ戻る
        self.go_to_admin_top_page()

    def check_block_page_by_paypal_regsiter(self):

        ##今度はゴールド会員として登録して表示をチェックするためにゴールド会員のページを作成
        self.go_to_paypal_setting_page()

        #新しくPayPalの設定を作成
        self.paypal_add_new_func.go_to_pay_pal_register_page()

        self.paypal_add_new_func.add_member_subscription_payment()

        payapl_short_code = self.paypal_carete_page_func.get_new_pay_pal_short_code(
        )

        #固定ページ一覧に移動
        self.go_page_list()

        self.driver_action_func.go_to_add_new_page()

        self.paypal_carete_page_func.create_member_subscription_page(
            payapl_short_code)

        #公開ボタンをクリックする。
        self.driver_action_func.click_publish_btn()

        paypal_page_link = self.driver_action_func.edit_page_link()

        new_paypal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_paypal_register_driver.get(paypal_page_link)

        ##今度はゴールド会員として登録して表示をチェックする。
        # 新しいブラウザでインスタンス作成
        paypal_register_func = Test_User_Normal_Register(
            new_paypal_register_driver)
        paypal_register_func.nomarl_put_user_info_to_form()

        payment_register_func = Test_User_Payment_Register(
            new_paypal_register_driver)
        payment_register_func.click_register_page_pay_pal_btn()
        #payment_register_func.click_new_register_page_pay_pal_btn()

        #新しく
        new_paypal_lesson_progress_func = Lesson_Progress(
            new_paypal_register_driver)
        new_paypal_lesson_progress_func.go_to_lesson_list_page()

        #ドライバーを新しくして、またインスタンス作成
        public_member_rank_func = Public_Member_Rank(
            new_paypal_register_driver)

        result = public_member_rank_func.check_is_user_get_ranked()

        if (result == False):
            another_driver_action_func = Driver_Action(
                new_paypal_register_driver)
            xpath = "//ul[@id='wp-admin-bar-top-secondary']/li[@id='wp-admin-bar-my-account']/div[@class='ab-sub-wrapper']/ul[@id='wp-admin-bar-user-actions']/li[@id='wp-admin-bar-user-info']/a[@class='ab-item']/span[@class='display-name']"
            target_user_name = another_driver_action_func.get_element_by_xpath(
                xpath).get_attribute("innerHTML")

            #admin側を動かすために、あどみん側のドライバーを渡す。
            paypal_admin_member_rank_func = Public_Member_Rank(self.chrome)

            paypal_admin_member_rank_func.set_user_status_to_gold(
                target_user_name)

            paypal_admin_member_rank_func.go_to_admin_top_page(self.target_url)

            public_member_rank_func.go_to_lesson_list_page()

        public_member_rank_func.check_lesson_overview_block_page()

        self.driver_action_func.stop(2)

        self.driver_action_func.quit(new_paypal_register_driver)

    def reset_block_page(self):
        self.go_page_list()
        self.go_to_lesson_over_view_page()

        self.admin_member_rank_func.reset_block_setting_overview_page()

    def check_block_page_by_normal_regsiter(self):

        #固定ページ一覧に移動
        self.go_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        new_link = self.user_register_func.get_new_register_page_link()

        # 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        lesson_progress_func = Lesson_Progress(new_normal_register_driver)

        #動画一覧ページに移動して、そのリンクの要素を取得
        lesson_progress_func.go_to_lesson_list_page()

        #ドライバーを新しくして、またインスタンス作成
        public_member_rank_func = Public_Member_Rank(
            new_normal_register_driver)

        public_member_rank_func.check_lesson_overview_block_page()

        self.driver_action_func.stop(2)

        self.driver_action_func.quit(new_normal_register_driver)

    def go_to_paypal_setting_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_paypal_page_path = self.admin_xpath_lists[
            'admin_guild_press_paypal_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path, admin_guild_press_paypal_page_path)

    def go_to_new_register_page(self):
        admin_new_regsiter_page_path = self.admin_xpath_lists[
            'admin_new_regsiter_page_path']

        self.driver_action_func.single_move_admin_page(
            admin_new_regsiter_page_path)

    def go_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_lesson_over_view_page(self):
        lesson_over_view_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_over_view_page_path']
        lesson_over_view_list_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_over_view_list_page_path']

        self.driver_action_func.move_admin_page(
            lesson_over_view_page_path, lesson_over_view_list_page_path)

    def go_to_member_rank_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_member_rank_page_path = self.admin_xpath_lists[
            'admin_guild_press_member_rank_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path,
            admin_guild_press_member_rank_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')
Esempio n. 6
0
class Text_Docs_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.admin_texts_docs_func = Admin_Texts_Docs(driver)
        self.user_register_func = User_Register_Setting(driver)
        self.paypal_add_new_func = Pay_Pal_Add_New_One(driver)
        self.paypal_carete_page_func = Pay_Pal_Create_Page(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        ##レッスン詳細ページにブロックを設定する。
        #GuildPressレッスン一覧新規追加ページへ移動
        self.go_to_texts_docs_page()

        # 教材などを新しく追加する。
        self.admin_texts_docs_func.add_texts_docs_info()

        #レッスン一覧へ移動
        self.go_to_lesson_detail_page()

        #教材一覧へ移動
        self.go_to_texts_docs_page()

        #ショートコード取得
        texts_docs_shortcodes = self.admin_texts_docs_func.get_dwd_show_shortcode(
        )

        #レッスン一覧へ移動
        self.go_to_lesson_detail_page()

        #ショートコードセット
        self.admin_texts_docs_func.put_short_codes_to_lesson_detail(
            texts_docs_shortcodes)

        self.driver_action_func.stop(10)

        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

        #固定ページ一覧に移動
        self.go_to_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        self.check_texts_docs_by_normal_user()

        #とっぷぺーじへ移動
        self.go_to_admin_top_page()

    def check_texts_docs_by_normal_user(self):

        new_link = self.user_register_func.get_new_register_page_link()

        # 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        public_texts_docs_func = Public_Texts_Docs(new_normal_register_driver)

        public_texts_docs_func.go_to_texts_list_page()

        public_texts_docs_func.check_texts_docs_page()

        self.driver_action_func.quit(new_normal_register_driver)

    def go_to_new_register_page(self):
        admin_new_regsiter_page_path = self.admin_xpath_lists[
            'admin_new_regsiter_page_path']

        self.driver_action_func.single_move_admin_page(
            admin_new_regsiter_page_path)

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_lesson_detail_page(self):
        admin_guild_press_lesson_detail_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_page_path']
        admin_guild_press_lesson_detail_list_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_list_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_lesson_detail_page_path,
            admin_guild_press_lesson_detail_list_page_path)

    def go_to_texts_docs_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_texts_docs_page_path = self.admin_xpath_lists[
            'admin_guild_press_texts_docs_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path,
            admin_guild_press_texts_docs_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')
class Public_Add_Quiz:
    def __init__(self, driver):

        self.chrome = driver
        self.driver_func = Driver_Action(driver)
        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists_xpath = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

        # 管理画面内の項目に関するパス(作成した固定ページリストとか)
        self.admin_parts_xpath = self.admin_xpath_list_func.get_admin_parts()

        #ユーザー画面内の項目に関するパス
        self.public_parts_xpath = self.admin_xpath_list_func.get_public_parts()

        self.base_dir = self.basic_func.get_base_dir_path()

    def go_to_lesson_list_page(self):
        self.driver_func.go_to_public_nav_menu('動画一覧ページ')

    def go_to_element_lesson_list_page(self):
        all_lesson_list = self.public_parts_xpath['all_lesson_list_xpath']
        all_lesson_list_link = self.public_parts_xpath[
            'all_lesson_list_link_xpath']

        target_lesson_lists = {'英語初級講座', '英語中級講座', '英語上級講座'}

        for target_lesson_text in target_lesson_lists:

            all_lesson_lists_link_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_list_link)
            all_lesson_lists_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_list)

            #概要ページから該当する名前順にリンクの要素を取得
            link_elem = self.basic_func.get_target_link_element(
                all_lesson_lists_elem, all_lesson_lists_link_elem,
                target_lesson_text)

            #リンクを取得
            lesson_detail_link = self.driver_func.get_link(link_elem)

            #リンクに飛ぶ
            self.driver_func.move_to_page_by_link(self.chrome,
                                                  lesson_detail_link)

            self.driver_func.scroll_down(self.chrome)
            self.driver_func.scroll_top(self.chrome)

            self.go_to_first_lesson()

    def go_to_first_lesson(self):

        first_lesson_link = self.public_parts_xpath['first_lesson_link_xpath']
        #概要ページのすべてのレッスンを取得する
        first_lesson_elem = self.driver_func.get_elements_by_xpath(
            first_lesson_link)

        lesson_comp_btn = self.public_parts_xpath['lesson_comp_btn_xpath']

        try:
            lesson_elem = self.driver_func.get_elements_by_xpath(
                '//div[@id="lesson-list-box"]/div[@class="lesson-list-detail-box lesson-bg-lock"]'
            )
        except Exception as e:
            lesson_count = len(first_lesson_elem)
        else:
            lesson_count = len(first_lesson_elem) + len(lesson_elem)

        #最初のレッスンをクリックする。
        self.driver_func.click_item(first_lesson_elem[0])

        self.driver_func.stop(1)

        for x in range(lesson_count):

            try:
                lesson_comp_btn_elem = self.driver_func.get_element_by_xpath(
                    lesson_comp_btn)
                self.driver_func.click_item(lesson_comp_btn_elem)
            except Exception as e:
                self.progress_quiz()
            else:
                self.progress_btn()

        self.go_to_lesson_list_page()

    #通常のボタンクリックで、次のページへ進むタイプ
    def progress_btn(self):
        lesson_next_btn = self.public_parts_xpath['lesson_next_btn_xpath']
        #次のページへ進むが最後のページにはないので、それをチェックする。
        try:
            lesson_next_btn_elem = self.driver_func.get_element_by_xpath(
                lesson_next_btn)
            self.driver_func.click_item(lesson_next_btn_elem)
            self.driver_func.stop(1)
        except NoSuchElementException:
            pass

    #クイズに答える形式で、次のページへ進むタイプ
    def progress_quiz(self):
        lesson_quiz_lists_xpath = self.public_parts_xpath[
            'lesson_quiz_lists_xpath']
        send_answer_xpath = self.public_parts_xpath['send_answer_xpath']
        next_btn_xpath = self.public_parts_xpath['next_btn_xpath']

        lesson_quiz_lists_elem = self.driver_func.get_elements_by_xpath(
            lesson_quiz_lists_xpath)
        send_answer_elem = self.driver_func.get_element_by_xpath(
            send_answer_xpath)

        for x in range(0, len(lesson_quiz_lists_elem)):
            self.driver_func.click_item(lesson_quiz_lists_elem[x])
            self.driver_func.click_item(send_answer_elem)
            self.driver_func.stop(1)
            #正解して、次へ進むボタンが表示されるまでループを繰り返す。
            try:
                next_btn_elem = self.driver_func.get_element_by_xpath(
                    next_btn_xpath)
                self.driver_func.click_item(next_btn_elem)
            except Exception as e:
                pass
            else:
                break
        """
class Public_Lesson_Lock:
    def __init__(self, driver):

        self.chrome = driver
        self.driver_func = Driver_Action(driver)
        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists_xpath = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

        # 管理画面内の項目に関するパス(作成した固定ページリストとか)
        self.admin_parts_xpath = self.admin_xpath_list_func.get_admin_parts()

        #ユーザー画面内の項目に関するパス
        self.public_parts_xpath = self.admin_xpath_list_func.get_public_parts()

        self.base_dir = self.basic_func.get_base_dir_path()

    def check_element_page(self):

        self.go_to_element_lesson_list_page()

        all_lesson_title_list_xpath = self.public_parts_xpath[
            'all_lesson_title_list_xpath']
        lesson_detail_link = self.public_parts_xpath['lesson_detail_lists']

        block_page_list = ['英語リスニング(初級講座)', '英語スピーキング(初級講座)']
        for block_page_text in block_page_list:
            lesson_detail_elem = self.driver_func.get_elements_by_xpath(
                lesson_detail_link)
            all_lesson_title_lists_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_title_list_xpath)

            lesson_detail_page_link = self.basic_func.get_target_link_element(
                all_lesson_title_lists_elem, lesson_detail_elem,
                block_page_text)

            self.driver_func.click_item(lesson_detail_page_link)

            self.driver_func.stop(2)

            self.go_to_lesson_list_page()
            self.go_to_element_lesson_list_page()

    def go_to_lesson_list_page(self):
        self.driver_func.go_to_public_nav_menu('動画一覧ページ')

    def go_to_element_lesson_list_page(self):
        all_lesson_list = self.public_parts_xpath['all_lesson_list_xpath']
        all_lesson_list_link = self.public_parts_xpath[
            'all_lesson_list_link_xpath']

        target_lesson_lists = {'英語初級講座', '英語中級講座', '英語上級講座'}

        for target_lesson_text in target_lesson_lists:

            all_lesson_lists_link_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_list_link)
            all_lesson_lists_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_list)

            #概要ページから該当する名前順にリンクの要素を取得
            link_elem = self.basic_func.get_target_link_element(
                all_lesson_lists_elem, all_lesson_lists_link_elem,
                target_lesson_text)

            #リンクを取得
            lesson_detail_link = self.driver_func.get_link(link_elem)

            #リンクに飛ぶ
            self.driver_func.move_to_page_by_link(self.chrome,
                                                  lesson_detail_link)

            self.driver_func.scroll_down(self.chrome)
            self.driver_func.scroll_top(self.chrome)

            self.go_to_first_lesson()

    def go_to_first_lesson(self):

        first_lesson_link = self.public_parts_xpath['first_lesson_link_xpath']

        #概要ページのすべてのレッスンを取得する
        first_lesson_elem = self.driver_func.get_elements_by_xpath(
            first_lesson_link)

        lesson_comp_btn = self.public_parts_xpath['lesson_comp_btn_xpath']
        lesson_next_btn = self.public_parts_xpath['lesson_next_btn_xpath']

        try:
            lesson_elem = self.driver_func.get_elements_by_xpath(
                '//div[@id="lesson-list-box"]/div[@class="lesson-list-detail-box lesson-bg-lock"]'
            )
        except Exception as e:
            lesson_count = len(first_lesson_elem)
        else:
            lesson_count = len(first_lesson_elem) + len(lesson_elem)

        #最初のレッスンをクリックする。
        self.driver_func.click_item(first_lesson_elem[0])

        self.driver_func.stop(1)

        #レッスンの総数分だけ、レッスン完了をクリックして、レッスンを完了していく。
        for i in range(lesson_count):
            lesson_comp_btn_elem = self.driver_func.get_element_by_xpath(
                lesson_comp_btn)
            self.driver_func.click_item(lesson_comp_btn_elem)

            #次のページへ進むが最後のページにはないので、それをチェックする。
            try:
                lesson_next_btn_elem = self.driver_func.get_element_by_xpath(
                    lesson_next_btn)
                self.driver_func.click_item(lesson_next_btn_elem)
            except NoSuchElementException:
                pass

        self.go_to_lesson_list_page()
class News_Controller:

	def __init__(self, driver, target_url):
		self.chrome = driver
		self.target_url = target_url

		self.admin_xpath_list_func = Admin_Menu_Path()
		self.basic_func = Basic()
		self.driver_action_func = Driver_Action( driver )
		self.admin_news_func = Admin_News( driver )
		self.user_register_func = User_Register_Setting( driver )
		self.paypal_add_new_func = Pay_Pal_Add_New_One( driver )
		self.paypal_carete_page_func = Pay_Pal_Create_Page( driver )


		# 管理画面のメニューのパスを返す
		self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath()

		# 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
		self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath()

	def start( self ):
		#固定ページ一覧に移動
		self.go_page_list()

		#固定ページの中から、新規登録ページに移動する。
		self.go_to_my_page()

		#ニュース一覧のショートコードをセットする
		self.admin_news_func.add_news_code()

		#レッスン詳細一覧へ移動
		self.go_to_lesson_detail_page()

		#固定ページ一覧に移動
		self.go_page_list()

		#固定ページの中から、新規登録ページに移動する。
		self.go_to_new_register_page()

		#ニュースを普通の登録状態で確認
		self.check_news_page_by_normal_regsiter()

		#トップページへ移動
		self.go_to_admin_top_page()

		#ニュースを3つの状態にしてチェックする。
		self.check_three_news_page()

		#トップページへ移動
		self.go_to_admin_top_page()

		#タイトルを編集した状態のページをチェック
		self.check_news_page_edited_title()

		#トップページへ移動
		self.go_to_admin_top_page()

	def check_news_page_edited_title( self ):

		#固定ページ一覧に移動
		self.go_page_list()

		#固定ページの中から、新規登録ページに移動する。
		self.go_to_my_page()

		#タイトルを編集した状態のショートコードページを追加
		self.admin_news_func.add_test_title_news_code()

		#レッスン詳細一覧へ移動
		self.go_to_lesson_detail_page()

		#固定ページ一覧に移動
		self.go_page_list()

		#固定ページの中から、新規登録ページに移動する。
		self.go_to_new_register_page()


		self.check_news_page_by_normal_regsiter()


	def check_three_news_page( self ):

		#固定ページ一覧に移動
		self.go_page_list()

		#固定ページの中から、マイページに移動する。
		self.go_to_my_page()

		#3つのニュースを表示するようにショートコードを書き換える。
		self.admin_news_func.add_three_news_code()

		#レッスン詳細一覧へ移動
		self.go_to_lesson_detail_page()

		#固定ページ一覧に移動
		self.go_page_list()

		#固定ページの中から、新規登録ページに移動する。
		self.go_to_new_register_page()

		self.check_news_page_by_normal_regsiter()

	def check_news_page_by_normal_regsiter(self):

		new_link = self.user_register_func.get_new_register_page_link()

		# 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
		new_normal_register_driver = webdriver.Chrome(ChromeDriverManager().install())
		new_normal_register_driver.get( new_link )

		# 新しいブラウザでインスタンス作成
		normal_register_func = Test_User_Normal_Register( new_normal_register_driver )

		# ユーザー情報を入れて、新しくユーザーを登録
		normal_register_func.nomarl_put_user_info_to_form()

		public_news_func = Public_News( new_normal_register_driver )

		#マイページへ移動して表示を確認
		public_news_func.go_to_my_page()

		self.driver_action_func.quit( new_normal_register_driver )


	def go_to_paypal_setting_page(self):
		admin_guild_press_page_path = self.admin_xpath_lists['admin_guild_press_page_path']
		admin_guild_press_paypal_page_path = self.admin_xpath_lists['admin_guild_press_paypal_page_path']

		self.driver_action_func.move_admin_page( admin_guild_press_page_path, admin_guild_press_paypal_page_path )


	def go_to_new_register_page( self ):
		admin_new_regsiter_page_path = self.admin_xpath_lists['admin_new_regsiter_page_path']

		self.driver_action_func.single_move_admin_page( admin_new_regsiter_page_path )


	def go_page_list( self ):
		admin_page_path = self.admin_xpath_lists['admin_page_path']
		admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

		self.driver_action_func.move_admin_page( admin_page_path, admin_list_page_path )

	def go_to_lesson_over_view_page( self ):
		lesson_over_view_page_path = self.admin_xpath_lists['admin_guild_press_lesson_over_view_page_path']
		lesson_over_view_list_page_path = self.admin_xpath_lists['admin_guild_press_lesson_over_view_list_page_path']

		self.driver_action_func.move_admin_page( lesson_over_view_page_path, lesson_over_view_list_page_path )

	def go_to_member_rank_page( self ):
		admin_guild_press_page_path = self.admin_xpath_lists['admin_guild_press_page_path']
		admin_guild_press_member_rank_page_path = self.admin_xpath_lists['admin_guild_press_member_rank_page_path']

		self.driver_action_func.move_admin_page( admin_guild_press_page_path, admin_guild_press_member_rank_page_path )

	def go_to_admin_top_page(self):
		self.driver_action_func.move_to_page_by_link( self.chrome, self.target_url + 'wp-admin/' )


	def go_to_lesson_detail_page( self ):
		admin_guild_press_lesson_detail_page_path = self.admin_xpath_lists['admin_guild_press_lesson_detail_page_path']
		admin_guild_press_lesson_detail_list_page_path = self.admin_xpath_lists['admin_guild_press_lesson_detail_list_page_path']

		self.driver_action_func.move_admin_page( admin_guild_press_lesson_detail_page_path, admin_guild_press_lesson_detail_list_page_path )

	def go_to_my_page( self ):
		admin_go_to_mypage_path = self.admin_xpath_lists['admin_go_to_mypage_path']

		self.driver_action_func.single_move_admin_page( admin_go_to_mypage_path )
class Edit_User_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.user_register_func = User_Register_Setting(driver)
        self.paypal_add_new_func = Pay_Pal_Add_New_One(driver)
        self.paypal_carete_page_func = Pay_Pal_Create_Page(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):

        #固定ページ一覧に移動
        self.go_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        #普通に登録して、ユーザー情報を編集できるかチェックする。
        self.check_edit_user_info()

        #トップページへ戻る
        self.go_to_admin_top_page()

    def check_edit_user_info(self):

        new_link = self.user_register_func.get_new_register_page_link()

        # 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        public_edit_user_func = Public_Edit_User(new_normal_register_driver)
        public_edit_user_func.go_to_my_page()

        public_edit_user_func.go_to_edit_page()

        public_edit_user_func.edit_user_info()

        self.driver_action_func.stop(5)

        self.driver_action_func.quit(new_normal_register_driver)

    def go_to_lesson_detail_page(self):
        admin_guild_press_lesson_detail_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_page_path']
        admin_guild_press_lesson_detail_list_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_list_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_lesson_detail_page_path,
            admin_guild_press_lesson_detail_list_page_path)

    def go_to_my_page(self):
        admin_go_to_mypage_path = self.admin_xpath_lists[
            'admin_go_to_mypage_path']

        self.driver_action_func.single_move_admin_page(admin_go_to_mypage_path)

    def go_to_paypal_setting_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_paypal_page_path = self.admin_xpath_lists[
            'admin_guild_press_paypal_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path, admin_guild_press_paypal_page_path)

    def go_to_new_register_page(self):
        admin_new_regsiter_page_path = self.admin_xpath_lists[
            'admin_new_regsiter_page_path']

        self.driver_action_func.single_move_admin_page(
            admin_new_regsiter_page_path)

    def go_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_lesson_over_view_page(self):
        lesson_over_view_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_over_view_page_path']
        lesson_over_view_list_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_over_view_list_page_path']

        self.driver_action_func.move_admin_page(
            lesson_over_view_page_path, lesson_over_view_list_page_path)

    def go_to_member_rank_page(self):
        admin_guild_press_page_path = self.admin_xpath_lists[
            'admin_guild_press_page_path']
        admin_guild_press_member_rank_page_path = self.admin_xpath_lists[
            'admin_guild_press_member_rank_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_page_path,
            admin_guild_press_member_rank_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')
Esempio n. 11
0
class Public_Calendar:
    def __init__(self, driver):

        self.chrome = driver
        self.driver_func = Driver_Action(driver)
        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists_xpath = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

        # 管理画面内の項目に関するパス(作成した固定ページリストとか)
        self.admin_parts_xpath = self.admin_xpath_list_func.get_admin_parts()

        #ユーザー画面内の項目に関するパス
        self.public_parts_xpath = self.admin_xpath_list_func.get_public_parts()

        self.base_dir = self.basic_func.get_base_dir_path()

        self.calendar_page_url = self.basic_func.get_calendar_page_url()

    def go_to_calendar_page(self):

        self.driver_func.move_to_page_by_link(self.chrome,
                                              self.calendar_page_url)

    def click_calendar(self, target_calendar_name):
        calendar_cell_xpath = self.public_parts_xpath[
            'calendar_cell_list_xpath']
        calendar_cells = self.driver_func.get_elements_by_xpath(
            calendar_cell_xpath)

        calendar_cell_elem = self.basic_func.get_target_element(
            calendar_cells, target_calendar_name)
        self.driver_func.click_item(calendar_cell_elem)

    def go_to_calendar_register_page(self):
        calendar_register_xpath = self.public_parts_xpath[
            'calendar_cell_register_xpath']
        calendar_register_elem = self.driver_func.get_element_by_xpath(
            calendar_register_xpath)
        self.driver_func.click_item(calendar_register_elem)

    def put_calendar_register_info(self):

        date_time1_elem = self.driver_func.get_element_by_name('date_time1')
        date_time2_elem = self.driver_func.get_element_by_name('date_time2')
        comment_elem = self.driver_func.get_element_by_name('comment')
        submit_btn_elem = self.driver_func.get_element_by_id('submit')

        self.driver_func.put_item_info(date_time1_elem, '13:00')
        self.driver_func.put_item_info(date_time2_elem, '16:00')
        self.driver_func.put_item_info(comment_elem, 'かれんだーてすと')

        self.driver_func.click_item(submit_btn_elem)

    def go_to_calendar_edit_page(self):
        calendar_edit_xpath = self.public_parts_xpath[
            'calendar_cell_edit_xpath']
        calendar_edit_elem = self.driver_func.get_element_by_xpath(
            calendar_edit_xpath)
        self.driver_func.click_item(calendar_edit_elem)

    def put_calendar_edit_info(self):

        date_time1_elem = self.driver_func.get_element_by_name('date_time1')
        date_time2_elem = self.driver_func.get_element_by_name('date_time2')
        comment_elem = self.driver_func.get_element_by_name('comment')
        submit_btn_elem = self.driver_func.get_element_by_id('submit')

        self.driver_func.clear_item_info(date_time1_elem)
        self.driver_func.put_item_info(date_time1_elem, '13:00')

        self.driver_func.clear_item_info(date_time2_elem)
        self.driver_func.put_item_info(date_time2_elem, '16:00')

        self.driver_func.clear_item_info(comment_elem)
        self.driver_func.put_item_info(comment_elem, 'かれんだーてすと')

        self.driver_func.click_item(submit_btn_elem)
Esempio n. 12
0
class Init_Set_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.init_settings_func = Init_Settings(driver)
        self.user_register_setting_func = User_Register_Setting(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def get_page_list(self):

        page_lists = {
            '新規登録ページ': '[guild_press_user_register]',
            'マイぺージ': '[guild_press_my_page]',
            'ログインページ': '[guild_press_login_page]',
            'ユーザー情報編集ページ': '[guild_press_edit_user_info]',
            '動画一覧ページ': '[guild_press_all_lesson]',
            '教材一覧ページ': '[guild_press_list_texts_docs]',
        }

        return page_lists

    def start(self):
        admin_main_setting_path = self.admin_xpath_lists[
            'admin_main_setting_path']
        admin_sub_setting_path = self.admin_xpath_lists[
            'admin_sub_setting_path']
        page_lists = self.get_page_list()

        for page_title, page_shortcode in page_lists.items():
            #固定ページリストへ移動
            self.go_to_page_list()

            #ページの作成
            self.driver_action_func.go_to_add_new_page()
            self.init_settings_func.create_new_guild_press_shortcode_page(
                page_title, page_shortcode)

            #公開ボタンをクリック
            self.driver_action_func.click_publish_btn()

            self.driver_action_func.stop(3)
            #一度トップページへ移動
            self.go_to_admin_top_page()

        #設定の保存
        self.init_settings_func.move_to_guild_press_setting_page()
        self.init_settings_func.set_up_guild_press_settings()

        #一般設定に移動
        self.driver_action_func.move_admin_page(admin_main_setting_path,
                                                admin_sub_setting_path)

        #一般設定がちゃんとされているかチェックする。
        self.user_register_setting_func.check_membership_setting()

        #トップページへ移動
        self.go_to_admin_top_page()

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)
class Admin_Many_Calendars_Controller:

    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action( driver )
        self.admin_many_calendar = Admin_Many_Calendar( driver )
        self.init_settings_func = Init_Settings( driver )

        self.calendar_titles = []

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath()

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath()

        #カレンダーを登録できるリンクのパス
        self.admin_calendar_parts_xpath = self.admin_xpath_list_func.get_many_calendar_parts()

    def start( self ):
        #固定ページ一覧へ移動
        self.go_to_page_list()

        # カレンダー一覧ページへ移動する。
        self.go_to_calendar_page()

        #カレンダーデータの登録
        self.register_many_calendar()

        #トップページへ戻る
        self.go_to_admin_top_page()

    def get_calendar_titles( self ):
        return self.calendar_titles

    def register_many_calendar(self):

        for calendar_register_list_name, calendar_register_list_xpath in self.admin_calendar_parts_xpath.items():
            self.admin_many_calendar.go_to_register_calendar_list_page()
            result = self.admin_many_calendar.go_to_register_calendar_page( calendar_register_list_xpath )

            if result :
                for x in range( 5 ):
                    try:

                        calendar_title = self.admin_many_calendar.put_calendar_info()
                        self.admin_many_calendar.edit_calendar_info_page( calendar_title )
                        self.add_calendar_title_to_list( calendar_title )

                    except Exception as e:
                        print('error')

                    self.admin_many_calendar.go_to_register_calendar_list_page()
                    self.admin_many_calendar.go_to_register_calendar_page( calendar_register_list_xpath )


    def go_to_page_list( self ):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page( admin_page_path, admin_list_page_path )

    def add_calendar_title_to_list( self, calendar_title ):
        self.calendar_titles.append( calendar_title )

    def go_to_calendar_page( self ):
        lesson_detail_page_path = self.admin_xpath_lists['admin_guild_press_lesson_detail_page_path']
        calendar_page_path = self.admin_xpath_lists['admin_guild_press_lesson_calendar_page_path']

        self.driver_action_func.move_admin_page( lesson_detail_page_path, calendar_page_path )

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link( self.chrome, self.target_url + 'wp-admin/' )
class Normal_User_Register_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.user_register_setting_func = User_Register_Setting(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):

        #固定ページ一覧に移動
        self.go_to_page_list()
        self.go_to_new_register_page()

        new_link = self.user_register_setting_func.get_new_register_page_link()

        # 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()
        normal_register_func.quit_browser()

        self.go_to_user_list_page()

        # 登録したユーザーの削除
        self.user_register_setting_func.delete_registered_user()

        #トップページへ移動
        self.go_to_admin_top_page()

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_new_register_page(self):
        #固定ページの中から、新規登録ページに移動する。
        self.driver_action_func.single_move_admin_page(
            self.admin_xpath_lists['admin_new_regsiter_page_path'])

    def go_to_user_list_page(self):
        admin_user_list_page_path = self.admin_xpath_lists[
            'admin_user_list_page_path']
        admin_user_list_sub_page_path = self.admin_xpath_lists[
            'admin_user_list_sub_page_path']

        # ユーザー一覧ページへ移動
        self.driver_action_func.move_admin_page(admin_user_list_page_path,
                                                admin_user_list_sub_page_path)

    def go_to_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)
Esempio n. 15
0
class Admin_Rock_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.admin_lesson_lock_func = Admin_Lesson_Lock(driver)
        self.user_register_func = User_Register_Setting(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        ##レッスン詳細ページにブロックを設定する。
        self.go_to_lesson_detail_page()

        #ブロックの設定をしていく
        #self.admin_lesson_lock_func.set_block_page()

        #固定ページ一覧に移動
        self.go_to_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        self.check_block_page_by_normal_user()

        self.go_to_admin_top_page()

    def check_block_page_by_normal_user(self):

        new_link = self.user_register_func.get_new_register_page_link()

        # 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        public_lesson_lock_func = Public_Lesson_Lock(
            new_normal_register_driver)
        public_lesson_lock_func.go_to_lesson_list_page()

        public_lesson_lock_func.go_to_element_lesson_list_page()

        self.driver_action_func.quit(new_normal_register_driver)

    def go_to_new_register_page(self):
        admin_new_regsiter_page_path = self.admin_xpath_lists[
            'admin_new_regsiter_page_path']

        self.driver_action_func.single_move_admin_page(
            admin_new_regsiter_page_path)

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_lesson_detail_page(self):
        admin_guild_press_lesson_detail_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_page_path']
        admin_guild_press_lesson_detail_list_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_list_page_path']

        self.driver_action_func.move_admin_page(
            admin_guild_press_lesson_detail_page_path,
            admin_guild_press_lesson_detail_list_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')
class Admin_Calendar_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.admin_calendar_func = Admin_Calendar(driver)
        self.init_settings_func = Init_Settings(driver)

        self.calendar_title = ''

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        #固定ページ一覧へ移動
        self.go_to_page_list()

        #カレンダーの固定ページが作成されているチェックする。
        is_page_created = self.admin_calendar_func.create_public_calendar_page(
        )

        if not is_page_created:
            #カレンダーページ作成
            self.driver_action_func.go_to_add_new_page()
            self.init_settings_func.create_new_guild_press_shortcode_page(
                'カレンダーページ', '[guild_press_calender]')
            self.driver_action_func.click_publish_btn()

        # カレンダー一覧ページへ移動する。
        self.go_to_calendar_page()

        # カレンダー登録ページへ移動する
        self.admin_calendar_func.go_to_register_calendar_page()

        #カレンダー登録ページへカレンダー情報を入力.
        self.calendar_title = self.admin_calendar_func.put_calendar_info()

        #カレンダー編集ページへ移動する
        self.admin_calendar_func.edit_calendar_info_page(self.calendar_title)

        # カレンダーメール編集ページへ移動する。
        self.admin_calendar_func.go_to_calendar_email_page()

        # カレンダーメールの内容を入力する。
        self.admin_calendar_func.put_calendar_email_info()

        #トップページへ戻る
        self.go_to_admin_top_page()

    def get_calendar_title(self):
        return self.calendar_title

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_calendar_page(self):
        lesson_detail_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_detail_page_path']
        calendar_page_path = self.admin_xpath_lists[
            'admin_guild_press_lesson_calendar_page_path']

        self.driver_action_func.move_admin_page(lesson_detail_page_path,
                                                calendar_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')
Esempio n. 17
0
class Many_Lesson_Progress:
    def __init__(self, driver):

        self.chrome = driver
        self.driver_func = Driver_Action(driver)
        self.admin_xpath_list_func = Admin_Menu_Path()
        self.lesson_progress_xpath_list_func = Lesson_Progress_Path()
        self.basic_func = Basic()
        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists_xpath = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

        # 管理画面内の項目に関するパス(作成した固定ページリストとか)
        self.admin_parts_xpath = self.admin_xpath_list_func.get_admin_parts()

        #ユーザー側の画面のメニューとか、動画一覧などのパーツ
        self.public_parts_xpath = self.admin_xpath_list_func.get_public_parts()

        self.base_dir = self.basic_func.get_base_dir_path()

        self.lesson_list_page_url = self.basic_func.get_lesson_list_page()

    def go_to_lesson_list_page(self):
        print('go_to_lesson_list_page')
        self.driver_func.move_to_page_by_link(self.chrome,
                                              self.lesson_list_page_url)

    def progress_each_lesson(self):

        all_lesson_list = self.public_parts_xpath['all_lesson_list_xpath']
        all_lesson_list_link = self.public_parts_xpath[
            'all_lesson_list_link_xpath']

        first_lesson_link = self.public_parts_xpath['first_lesson_link_xpath']

        lesson_comp_btn = self.public_parts_xpath['lesson_comp_btn_xpath']
        lesson_next_btn = self.public_parts_xpath['lesson_next_btn_xpath']

        self.lesson_progress_xpath_list_func.create_many_lesson_posts()
        target_lesson_lists = self.lesson_progress_xpath_list_func.get_many_target_lesson_lists_path(
        )

        for target_lesson_text in target_lesson_lists:

            self.driver_func.stop(1)
            all_lesson_lists_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_list)
            all_lesson_lists_link_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_list_link)
            #概要ページから該当する名前順にリンクの要素を取得
            link_elem = self.basic_func.get_target_link_element(
                all_lesson_lists_elem, all_lesson_lists_link_elem,
                target_lesson_text)

            #リンクを取得
            lesson_detail_link = self.driver_func.get_link(link_elem)

            #リンクに飛ぶ
            self.driver_func.move_to_page_by_link(self.chrome,
                                                  lesson_detail_link)

            #概要ページのすべてのレッスンを取得する
            first_lesson_elem = self.driver_func.get_elements_by_xpath(
                first_lesson_link)

            #最初のレッスンをクリックする。
            self.driver_func.click_item(first_lesson_elem[0])

            self.driver_func.stop(1)

            #レッスンの総数分だけ、レッスン完了をクリックして、レッスンを完了していく。
            for i in range(len(first_lesson_elem)):
                lesson_comp_btn_elem = self.driver_func.get_element_by_xpath(
                    lesson_comp_btn)
                self.driver_func.click_item(lesson_comp_btn_elem)

                #次のページへ進むが最後のページにはないので、それをチェックする。
                try:
                    lesson_next_btn_elem = self.driver_func.get_element_by_xpath(
                        lesson_next_btn)
                    self.driver_func.click_item(lesson_next_btn_elem)
                except NoSuchElementException:
                    print('none')

            self.driver_func.move_to_page_by_link(self.chrome,
                                                  self.lesson_list_page_url)
Esempio n. 18
0
class Lesson_Progress_Controller:
    def __init__(self, driver, target_url):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.user_register_func = User_Register_Setting(driver)

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start(self):
        #固定ページ一覧に移動
        self.go_to_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        new_link = self.user_register_func.get_new_register_page_link()

        # 普通にbasicに新しく開く処理をするとなぜか、新しくひらいたクロームが落ちてしまうのでここで普通に新しく作成。
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        lesson_progress_func = Lesson_Progress(new_normal_register_driver)

        #動画一覧ページに移動して、そのリンクの要素を取得
        lesson_progress_func.go_to_lesson_list_page()

        #各動画の完了ボタンをクリックして、進捗を進めていく
        lesson_progress_func.progress_each_lesson()

        #トップページへ移動
        self.go_to_admin_top_page()

    def go_to_new_register_page(self):
        admin_new_regsiter_page_path = self.admin_xpath_lists[
            'admin_new_regsiter_page_path']
        self.driver_action_func.single_move_admin_page(
            admin_new_regsiter_page_path)

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')
class Public_Calendar_Controller:
    def __init__(self, driver, target_url, calendar_title):
        self.chrome = driver
        self.target_url = target_url

        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        self.driver_action_func = Driver_Action(driver)
        self.user_register_func = User_Register_Setting(driver)

        self.calendar_title = calendar_title

        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

    def start_many(self):

        #固定ページ一覧へ移動
        self.go_to_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        #新規登録のURLを取得
        new_link = self.user_register_func.get_new_register_page_link()

        #新しくドライバーを作成
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())

        #トップページへ移動
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        #インスタンス作成
        public_calendar_func = Public_Calendar(new_normal_register_driver)

        #カレンダーページへ移動
        public_calendar_func.go_to_calendar_page()

        for calendar_register_list_name in self.calendar_title:
            print(calendar_register_list_name)
            #カレンダーページの要素をクリックする。
            public_calendar_func.click_calendar(calendar_register_list_name)

            #カレンダーページ登録ページへ移動
            public_calendar_func.go_to_calendar_register_page()

            #カレンダー情報入力
            public_calendar_func.put_calendar_register_info()

            #カレンダー情報編集
            public_calendar_func.click_calendar(calendar_register_list_name)
            public_calendar_func.go_to_calendar_edit_page()
            public_calendar_func.put_calendar_edit_info()

            #カレンダーページへ移動
            public_calendar_func.go_to_calendar_page()

        self.driver_action_func.quit(new_normal_register_driver)

        self.go_to_admin_top_page()

    def start(self):
        #固定ページ一覧へ移動
        self.go_to_page_list()

        #固定ページの中から、新規登録ページに移動する。
        self.go_to_new_register_page()

        #新規登録のURLを取得
        new_link = self.user_register_func.get_new_register_page_link()

        #新しくドライバーを作成
        new_normal_register_driver = webdriver.Chrome(
            ChromeDriverManager().install())

        #トップページへ移動
        new_normal_register_driver.get(new_link)

        # 新しいブラウザでインスタンス作成
        normal_register_func = Test_User_Normal_Register(
            new_normal_register_driver)

        # ユーザー情報を入れて、新しくユーザーを登録
        normal_register_func.nomarl_put_user_info_to_form()

        #インスタンス作成
        public_calendar_func = Public_Calendar(new_normal_register_driver)

        #カレンダーページへ移動
        public_calendar_func.go_to_calendar_page()

        #カレンダーページの要素をクリックする。
        public_calendar_func.click_calendar(self.calendar_title)

        #カレンダーページ登録ページへ移動
        public_calendar_func.go_to_calendar_register_page()

        #カレンダー情報入力
        public_calendar_func.put_calendar_register_info()

        #カレンダー情報編集
        public_calendar_func.click_calendar(self.calendar_title)
        public_calendar_func.go_to_calendar_edit_page()
        public_calendar_func.put_calendar_edit_info()

        self.driver_action_func.quit(new_normal_register_driver)

        self.go_to_admin_top_page()

    def go_to_page_list(self):
        admin_page_path = self.admin_xpath_lists['admin_page_path']
        admin_list_page_path = self.admin_xpath_lists['admin_list_page_path']

        self.driver_action_func.move_admin_page(admin_page_path,
                                                admin_list_page_path)

    def go_to_admin_top_page(self):
        self.driver_action_func.move_to_page_by_link(
            self.chrome, self.target_url + 'wp-admin/')

    def go_to_new_register_page(self):
        admin_new_regsiter_page_path = self.admin_xpath_lists[
            'admin_new_regsiter_page_path']
        self.driver_action_func.single_move_admin_page(
            admin_new_regsiter_page_path)
Esempio n. 20
0
class Public_Member_Rank:
    def __init__(self, driver):

        self.chrome = driver
        self.driver_func = Driver_Action(driver)
        self.admin_xpath_list_func = Admin_Menu_Path()
        self.basic_func = Basic()
        # 管理画面のメニューのパスを返す
        self.admin_xpath_lists = self.admin_xpath_list_func.get_admin_menu_xpath(
        )

        # 管理画面メニュー内の新規追加や編集などのパーツのパスを返す。
        self.admin_list_parts_xpath = self.admin_xpath_list_func.get_admin_menu_list_parts_xpath(
        )

        # 管理画面内の項目に関するパス(作成した固定ページリストとか)
        self.admin_parts_xpath = self.admin_xpath_list_func.get_admin_parts()

        #ユーザー画面内の項目に関するパス
        self.public_parts_xpath = self.admin_xpath_list_func.get_public_parts()

        self.base_dir = self.basic_func.get_base_dir_path()

        self.lesson_list_page_url = self.basic_func.get_lesson_list_page()

    def go_to_lesson_list_page(self):
        self.driver_func.move_to_page_by_link(self.chrome,
                                              self.lesson_list_page_url)

    def check_element_page(self):

        self.go_to_element_lesson_list_page()

        all_lesson_title_list_xpath = self.public_parts_xpath[
            'all_lesson_title_list_xpath']
        lesson_detail_link = self.public_parts_xpath['lesson_detail_lists']

        block_page_list = ['英語リスニング(初級講座)', '英語スピーキング(初級講座)']
        for block_page_text in block_page_list:
            lesson_detail_elem = self.driver_func.get_elements_by_xpath(
                lesson_detail_link)
            all_lesson_title_lists_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_title_list_xpath)

            lesson_detail_page_link = self.basic_func.get_target_link_element(
                all_lesson_title_lists_elem, lesson_detail_elem,
                block_page_text)

            self.driver_func.click_item(lesson_detail_page_link)

            self.driver_func.stop(2)

            self.go_to_lesson_list_page()
            self.go_to_element_lesson_list_page()

    def check_is_user_get_ranked(self):

        try:
            pay_pal_btn_xpath = '//button[@id="paypal_btn"]'
            pay_pal_btn = self.driver_func.get_element_by_xpath(
                pay_pal_btn_xpath)

        except NoSuchElementException:
            #特に問題ない場合はtrueを返す。
            return True
        else:
            #ボタンが存在する場合は、ユーザーが会員楽を取得できていないので、falseを返してもう一度処理させる。
            return False

    def go_to_element_lesson_list_page(self):
        all_lesson_list = self.public_parts_xpath['all_lesson_list_xpath']
        all_lesson_list_link = self.public_parts_xpath[
            'all_lesson_list_link_xpath']
        all_lesson_lists_elem = self.driver_func.get_elements_by_xpath(
            all_lesson_list)
        all_lesson_lists_link_elem = self.driver_func.get_elements_by_xpath(
            all_lesson_list_link)

        #概要ページから該当する名前順にリンクの要素を取得
        link_elem = self.basic_func.get_target_link_element(
            all_lesson_lists_elem, all_lesson_lists_link_elem, '英語初級講座')

        #リンクを取得
        lesson_detail_link = self.driver_func.get_link(link_elem)

        #リンクに飛ぶ
        self.driver_func.move_to_page_by_link(self.chrome, lesson_detail_link)

    def check_advanced_page(self):

        self.go_to_advanced_lesson_list_page()

        all_lesson_title_list_xpath = self.public_parts_xpath[
            'all_lesson_title_list_xpath']
        lesson_detail_link = self.public_parts_xpath['lesson_detail_lists']

        block_page_list = ['英語リスニング(上級講座)', '英語スピーキング(上級講座)']
        for block_page_text in block_page_list:

            lesson_detail_elem = self.driver_func.get_elements_by_xpath(
                lesson_detail_link)
            all_lesson_title_lists_elem = self.driver_func.get_elements_by_xpath(
                all_lesson_title_list_xpath)

            lesson_detail_page_link = self.basic_func.get_target_link_element(
                all_lesson_title_lists_elem, lesson_detail_elem,
                block_page_text)

            self.driver_func.click_item(lesson_detail_page_link)

            self.driver_func.stop(2)

            self.go_to_lesson_list_page()
            self.go_to_advanced_lesson_list_page()

    def go_to_advanced_lesson_list_page(self):
        all_lesson_list = self.public_parts_xpath['all_lesson_list_xpath']
        all_lesson_list_link = self.public_parts_xpath[
            'all_lesson_list_link_xpath']
        all_lesson_lists_elem = self.driver_func.get_elements_by_xpath(
            all_lesson_list)
        all_lesson_lists_link_elem = self.driver_func.get_elements_by_xpath(
            all_lesson_list_link)
        #概要ページから該当する名前順にリンクの要素を取得
        link_elem = self.basic_func.get_target_link_element(
            all_lesson_lists_elem, all_lesson_lists_link_elem, '英語上級講座')

        #リンクを取得
        lesson_detail_link = self.driver_func.get_link(link_elem)

        #リンクに飛ぶ
        self.driver_func.move_to_page_by_link(self.chrome, lesson_detail_link)

    def check_lesson_overview_block_page(self):
        all_lesson_list = self.public_parts_xpath['all_lesson_list_xpath']
        all_lesson_list_link = self.public_parts_xpath[
            'all_lesson_list_link_xpath']

        self.driver_func.stop(2)
        all_lesson_lists_elem = self.driver_func.get_elements_by_xpath(
            all_lesson_list)
        all_lesson_lists_link_elem = self.driver_func.get_elements_by_xpath(
            all_lesson_list_link)

        #概要ページから該当する名前順にリンクの要素を取得
        link_elem = self.basic_func.get_target_link_element(
            all_lesson_lists_elem, all_lesson_lists_link_elem, '英語上級講座')

        #リンクを取得
        lesson_detail_link = self.driver_func.get_link(link_elem)

        #リンクに飛ぶ
        self.driver_func.move_to_page_by_link(self.chrome, lesson_detail_link)

    def set_user_status_to_gold(self, target_user_name):
        self.go_to_user_list_page()

        user_list_path = "//form/table[@class='wp-list-table widefat fixed striped users']/tbody[@id='the-list']/tr/td[@class='username column-username has-row-actions column-primary']/strong/a"
        users_lists_path = self.driver_func.get_elements_by_xpath(
            user_list_path)

        target_user_link = self.basic_func.get_target_element(
            users_lists_path, target_user_name)

        self.driver_func.click_item(target_user_link)

        self.driver_func.scroll_down(self.chrome)

        self.select_registered_status()

        self.select_gold_rank()

        submit_btn = "//p[@class='submit']/input[@id='submit']"

        submit_btn_elem = self.driver_func.get_element_by_xpath(submit_btn)

        self.driver_func.click_item(submit_btn_elem)

    def go_to_user_list_page(self):
        admin_user_list_page_path = self.admin_xpath_lists[
            'admin_user_list_page_path']
        admin_user_list_sub_page_path = self.admin_xpath_lists[
            'admin_user_list_sub_page_path']

        # ユーザー一覧ページへ移動
        self.driver_func.move_admin_page(admin_user_list_page_path,
                                         admin_user_list_sub_page_path)

    def select_registered_status(self):
        user_register_status_path = "//div[@id='wpbody-content']/div[@id='profile-page']/form[@id='your-profile']/table[@class='form-table'][6]/tbody/tr[2]/td/select[@id='user_status']"

        user_register_status_element = self.driver_func.get_element_by_xpath(
            user_register_status_path)
        self.driver_func.select_item_by_text(user_register_status_element,
                                             "本登録")

    def select_gold_rank(self):
        select_box_rank = "//div[@id='wpcontent']/div[@id='wpbody']/div[@id='wpbody-content']/div[@id='profile-page']/form[@id='your-profile']/table[@class='form-table'][8]/tbody/tr[1]/td/select[@id='gp_user_rank']"

        rank_select_element = self.driver_func.get_element_by_xpath(
            select_box_rank)
        self.driver_func.select_item_by_text(rank_select_element, "ゴールド会員")

    def go_to_admin_top_page(self, target_url):
        self.driver_func.move_to_page_by_link(self.chrome,
                                              target_url + 'wp-admin/')