Beispiel #1
0
    def test_login_logout_user(self):
        # Simulating Fluent wait like in Java
        fluent_wait = WebDriverWait(
            self.driver, 30, poll_frequency=1, ignored_exceptions=[
                ElementNotVisibleException, ElementNotSelectableException])
        login_button = fluent_wait.until(
            EC.element_to_be_clickable(
                (By.CLASS_NAME, "auth-bar__item--text")))
        login_button.click()

        login_page = LoginPage(self.driver)
        login_page._validate_page(self.driver)
        login_page.input_login(self.login)
        login_page.input_password(self.password)
        login_page.submit_credentials()

        # WebDriverWait in combination with ExpectedCondition (Explicit Wait)
        logout_wait = WebDriverWait(self.driver, 30)
        logout_button = logout_wait.until(
            EC.element_to_be_clickable(
                (By.CLASS_NAME, "exit")))

        self.assertEqual("Выйти", logout_button.text)
        logout_button.click()

        login_wait = WebDriverWait(self.driver, 30)
        login_button = login_wait.until(
            EC.element_to_be_clickable(
                (By.CLASS_NAME, "auth-bar__item--text")))
        self.assertEqual("Вход", login_button.text)
Beispiel #2
0
    def test_activating_coupon(self):
        driver = self.driver
        driver.get(self.base_url + 'admin')

        product = Product(
            driver, self.base_url +
            "/index.php?route=product/product&path=20_27&product_id=41")

        coupon_setting = CouponSetting()
        coupon_setting.add('code', '1111')
        coupon_setting.add('enabled', 'Enabled')

        loginp = LoginPage(self.driver)
        dashboardp = loginp.login('admin', 'admin')
        couponp = dashboardp.open_coupons()

        add_couponp = couponp.edit_coupon(coupon_setting.get('code'))
        add_couponp.fill_option(coupon_setting)
        couponp = add_couponp.add()
        self.assertTrue(couponp.is_success())

        p_product = product.open()
        p_product.add_to_cart("1")
        p_cart = p_product.open_cart()

        p_cart.insert_coupon(coupon_setting.get('code'))
        self.assertTrue(p_cart.is_coupon_valid())
 def test_guest_can_go_to_login_page(self, browser):
     link = "http://selenium1py.pythonanywhere.com"
     page = MainPage(browser, link, 10)
     page.open()
     page.go_to_login_page()
     login_page = LoginPage(browser, browser.current_url)
     login_page.should_be_login_page()
Beispiel #4
0
class TestLogin(unittest.TestCase):
    def setUp(self):
        # 设置无头浏览器
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        # 登录
        self.driver = webdriver.Chrome(executable_path=(PD.driver_path),
                                       chrome_options=chrome_options)
        self.driver.maximize_window()
        self.driver.get(public.login_url)
        self.login_page = LoginPage(self.driver)

    def tearDown(self):
        self.driver.quit()

    def test_login_success(self):
        # 步骤
        self.login_page.login(LD.success_data["username"],
                              LD.success_data["password"])
        # 验证-检查点
        # self.assertEqual(self.driver.current_url, "http://120.79.176.157:8012/Index/index")
        self.assertEqual(
            IndexPage(self.driver).get_nickName(),
            LD.success_data["check_nickname"])

    @data(*LD.no_data)
    def test_login_noData(self, data):
        self.login_page.login(data["username"], data["password"])
        self.assertEqual(self.login_page.no_data_error(), data["check"])
Beispiel #5
0
    def test_using_coupon_future_date(self):
        driver = self.driver
        driver.get(self.base_url + 'admin')

        product = Product(
            driver, self.base_url +
            "/index.php?route=product/product&path=20_27&product_id=41")

        coupon_setting = CouponSetting()
        coupon_setting.add('name', 'Future date')
        coupon_setting.add('code', 'future')
        coupon_setting.add('start_date', tu.get_tommorow_date())

        loginp = LoginPage(self.driver)
        dashboardp = loginp.login('admin', 'admin')
        couponp = dashboardp.open_coupons()

        add_couponp = couponp.add_coupon()
        add_couponp.fill_option(coupon_setting)
        couponp = add_couponp.add()
        self.assertTrue(couponp.is_success())

        p_product = product.open()
        p_product.add_to_cart("1")
        p_cart = p_product.open_cart()

        p_cart.insert_coupon(coupon_setting.get('code'))
        self.assertTrue(p_cart.is_coupon_invalid())
Beispiel #6
0
    def testLoginPageLayout(self):
        """Test the login page layout contains the elements we expect.

    This should include elements inherited from the base page,
    BASE_PAGE_ELEMENTS (defined in layout.py), as well as elements specific to
    the login page, LOGIN_PAGE_ELEMENTS. Please add to each list as the UI
    is modified to ensure this test stays up to date.
    """
        self.driver.get(self.args.server_url + flask.url_for('login'))

        login_page = LoginPage(self.driver)
        for element_by_id in LoginPage.BASE_PAGE_ELEMENTS_FOR_LOGIN:
            base_page_element = login_page.get_element(element_by_id)
            self.assertIsNotNone(base_page_element)
            self.assertTrue(base_page_element.is_displayed())

        for element_by_id in LoginPage.BASE_PAGE_ELEMENTS_AFTER_LOGIN:
            base_page_search_element = login_page.get_element(element_by_id)
            self.assertIsNotNone(base_page_search_element)
            self.assertFalse(base_page_search_element.is_displayed())

        self.assertLogoLinksToLandingPage()

        for element_by_id in LoginPage.LOGIN_PAGE_ELEMENTS:
            login_page_element = login_page.get_element(element_by_id)
            self.assertIsNotNone(login_page_element)
            self.assertTrue(login_page_element.is_displayed())
 def __init__(self,
              driver: webdriver.Chrome,
              user_name,
              password,
              login_before=False):
     LoginPage.__init__(self, driver, user_name, password)
     self.login_before = login_before
     self.accept_another_buy()
Beispiel #8
0
 def __init__(self,
              driver: webdriver.Chrome,
              user_name,
              password,
              login_before=False):
     LoginPage.__init__(self, driver, user_name, password)
     self.login_before = login_before
     self.should_clear_cart = False
Beispiel #9
0
 def setUpClass(self):
     self.driver = webdriver.Firefox()
     self.driver.maximize_window()
     #调用登录方法
     login_p = LoginPage(self.driver)
     login_p.login('15658524692', '15658524692')
     time.sleep(5)
     self.invest_p = Invest_xqPage(self.driver)
     self.zhifu_p = InvestzfPage(self.driver)
Beispiel #10
0
    def login_and_post(self):

        self.driver.get('https://react-redux.realworld.io/')
        login = LoginPage(self.driver)
        login.login_user('*****@*****.**', 'maripuri2020')
        post = RegisterNewPost(self.driver, self.post)
        post.new_post()

        return post.get_url()
Beispiel #11
0
 def test_login_success(self):
     #arrange
     username = password = '******'
     #action
     login_page = LoginPage(self.driver, self.domain + 'wp-login.php')
     dashboard_page = login_page.login(username, password)
     #assert
     self.assertTrue('wp-admin' in self.driver.current_url)
     self.assertTrue(username in dashboard_page.greeting_link.text)
Beispiel #12
0
 def testAdminEmailIsDisplayed(self):
   """Test that the admin's email is displayed while logged in."""
   LoginPage(self.driver).Login(self.args.server_url, self.args.email,
                                self.args.password)
   for handler in self.handlers:
     self.driver.get(self.args.server_url + handler)
     dropdown_button = self.driver.find_element(*AdminFlow.OPEN_MENU_BUTTON)
     self.assertEquals(dropdown_button.text.lower(),
                       self.args.email.lower())
   LoginPage(self.driver).Logout(self.args.server_url)
Beispiel #13
0
 def setUp(self):
     # 设置无头浏览器
     chrome_options = Options()
     chrome_options.add_argument("--headless")
     # 登录
     self.driver = webdriver.Chrome(executable_path=(PD.driver_path),
                                    chrome_options=chrome_options)
     self.driver.maximize_window()
     self.driver.get(public.login_url)
     self.login_page = LoginPage(self.driver)
Beispiel #14
0
 def tearDown(self):
   """Teardown for test methods."""
   admin_flow = AdminFlow(self.driver)
   LoginPage(self.driver).Login(self.args.server_url, self.args.email,
                                self.args.password)
   admin_flow.remove_test_admin(self.TEST_ADMIN_AS_DICT['email'],
                                self.args.server_url,
                                should_raise_exception=False)
   LoginPage(self.driver).Logout(self.args.server_url)
   super(AdminFlowTest, self).tearDown()
Beispiel #15
0
class TestInvest(unittest.TestCase):

    def setUp(self):
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        # 登录
        self.driver = webdriver.Chrome(
            executable_path=(PD.driver_path),
            chrome_options=chrome_options)
        self.driver.maximize_window()
        self.driver.get(PD.login_url)
        self.bid_page = BidPage(self.driver)
        self.login_page = LoginPage(self.driver)
        self.index_page = IndexPage(self.driver)
        self.person_page = PersonPage(self.driver)
        self.login_page.login(PD.username, PD.password)

    def tearDown(self):
        self.driver.quit()

    def test_invest_success(self):
        # 进入个人详情页面,查看当前账户余额
        self.index_page.change_to_person_page()
        before_invest = self.person_page.get_balance()
        # 返回首页
        self.driver.back()
        time.sleep(5)
        # 首页选择一个标来进行投资
        self.index_page.click_firstbid()
        self.bid_page.input_invest_balance(ID.input_money)
        self.bid_page.click_submit_button()
    #     投资成功,读取提示信息
        self.assertEqual(self.bid_page.success_invest_msg(),ID.expect_success_invest_msg)
        # 投资成功,查看并激活
        self.bid_page.click_active_button()
    #     进入个人详情页面,读取投资后的个人账户余额
        # 刷新
        self.driver.refresh()
        time.sleep(2)
        after_invest = self.person_page.get_balance()
        self.assertEqual(int(float(before_invest)-float(after_invest)), ID.input_money)

    def test_invest_failed_by_No100(self):
        self.index_page.click_firstbid()
        self.bid_page.input_invest_balance(150)
        self.bid_page.click_submit_button()
        #     投资成功,读取提示信息
        self.assertEqual(self.bid_page.fail_invest_by_no100(), ID.expext_msg_by_no100)

    def test_invest_failed_by_No10(self):
        self.index_page.click_firstbid()
        self.bid_page.input_invest_balance(15)
        #     投资成功,读取提示信息
        self.assertEqual(self.bid_page.fail_invest_by_no10(), ID.expext_msg_by_no10)
Beispiel #16
0
class TestInvest(unittest.TestCase):

    def setUp(self):
		#设置无头浏览器
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        # 登录
        self.driver = webdriver.Chrome(executable_path=(r"C:\Users\yujing\AppData\Local\Programs\Python\Python37\chromedriver.exe"), chrome_options=chrome_options)
        self.driver.maximize_window()
        self.driver.get("http://120.79.176.157:8012/Index/login.html")
        self.bid_page = BidPage(self.driver)
        self.login_page = LoginPage(self.driver)
        self.index_page = IndexPage(self.driver)
        self.person_page = PersonPage(self.driver)
        self.login_page.login("18684720553", "python")

    def tearDown(self):
        self.driver.quit()

    def test_invest_success(self):

        # 进入个人详情页面,查看当前账户余额
        self.index_page.change_to_person_page()
        before_invest = self.person_page.get_balance()
        # 返回首页
        self.driver.back()
        time.sleep(5)
        # 首页选择一个标来进行投资
        self.index_page.click_firstbid()
        self.bid_page.input_invest_balance(1000)
        self.bid_page.click_submit_button()
    #     投资成功,读取提示信息
        self.assertEqual(self.bid_page.success_invest_msg(),"投标成功!")
        # 投资成功,查看并激活
        self.bid_page.click_active_button()
    #     进入个人详情页面,读取投资后的个人账户余额
        # 刷新
        self.driver.refresh()
        time.sleep(2)
        after_invest = self.person_page.get_balance()
        self.assertEqual(int(float(before_invest)-float(after_invest)), 1000)

    def test_invest_failed_by_No100(self):
        self.index_page.click_firstbid()
        self.bid_page.input_invest_balance(150)
        self.bid_page.click_submit_button()
        #     投资成功,读取提示信息
        self.assertEqual(self.bid_page.fail_invest_by_no100(), "投标金额必须为100的倍数")

    def test_invest_failed_by_No10(self):
        self.index_page.click_firstbid()
        self.bid_page.input_invest_balance(15)
        #     投资成功,读取提示信息
        self.assertEqual(self.bid_page.fail_invest_by_no10(), "请输入10的整数倍")
Beispiel #17
0
 def test_login_01_custom_login(self, driver, account, pw,
                                toast):  #修改:此处去掉传入logger,直接在py文件内赋值logger
     # def test_1_custom_login(self,driver,logger,data):
     logger.info("---测试登录流程---")
     # print(f"获得conftest.py的driver是:{driver}")
     login = LoginPage(driver, logger)  #此处依旧传入logger
     settings = SettingsPage(driver, logger)  #此处依旧传入logger
     settings.logout()
     # login.custom_login_enter()  //这个函数可以在这里调用,也可以直接封装在custom_login方法中。
     # login.custom_login("18500228275","111111")
     # login.custom_login(account,pw)
     login.custom_login(account, pw, toast)  #把toast也参数化
Beispiel #18
0
  def assertAnotherAdminCanBeAdded(self, test_url):
    """Test that adding another admin works from the given url.

    Args:
      test_url: The url to add the admin from.
    """
    # Try to login with the uncreated admin to ensure it does not exist.
    with self.assertRaises(TimeoutException):
      LoginPage(self.driver).Login(self.args.server_url,
                                   self.TEST_ADMIN_AS_DICT['email'],
                                   self.TEST_ADMIN_AS_DICT['password'])
    self.driver.get(test_url)

    # Assert that login failed (we're still on the login page).
    login_url = self.args.server_url + flask.url_for('login')
    self.assertEquals(login_url, self.driver.current_url)

    # Login as an existing admin to get access.
    LoginPage(self.driver).Login(self.args.server_url, self.args.email,
                                 self.args.password)
    self.driver.get(test_url)

    # Find the add admin dialog.
    admin_flow = AdminFlow(self.driver)
    dropdown_menu = admin_flow.getDropdownMenu()
    add_admin_dialog = admin_flow.get_add_admin_dialog(dropdown_menu)
    response_status = add_admin_dialog.find_element(
        *AdminFlow.ADD_ADMIN_RESPONSE_STATUS)
    self.assertEquals('', response_status.text)

    # Add the new admin.
    admin_flow.add_test_admin(self.TEST_ADMIN_AS_DICT['email'],
                              self.TEST_ADMIN_AS_DICT['password'],
                              add_admin_dialog)

    # Assert that it worked.
    response_status = add_admin_dialog.find_element(
        *AdminFlow.ADD_ADMIN_RESPONSE_STATUS)
    self.assertNotEqual('', response_status.text)
    admin_flow.close_dropdown_menu_from_dialog(add_admin_dialog)

    # Logout of the existing admin account.
    LoginPage(self.driver).Logout(self.args.server_url)

    # Login as the newly created test admin.
    LoginPage(self.driver).Login(self.args.server_url,
                                 self.TEST_ADMIN_AS_DICT['email'],
                                 self.TEST_ADMIN_AS_DICT['password'])
    self.driver.get(test_url)

    # Assert that login succeeded (we're now on the test_url page).
    self.assertEquals(test_url, self.driver.current_url)
Beispiel #19
0
    def setUp(self):
		#设置无头浏览器
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        # 登录
        self.driver = webdriver.Chrome(executable_path=(r"C:\Users\yujing\AppData\Local\Programs\Python\Python37\chromedriver.exe"), chrome_options=chrome_options)
        self.driver.maximize_window()
        self.driver.get("http://120.79.176.157:8012/Index/login.html")
        self.bid_page = BidPage(self.driver)
        self.login_page = LoginPage(self.driver)
        self.index_page = IndexPage(self.driver)
        self.person_page = PersonPage(self.driver)
        self.login_page.login("18684720553", "python")
Beispiel #20
0
    def test_remove_coupon(self):
        driver = self.driver
        driver.get(self.base_url + "admin")

        coupon_setting = CouponSetting()
        coupon_setting.add('code', '3333')

        loginp = LoginPage(self.driver)
        dashboardp = loginp.login('admin', 'admin')
        couponp = dashboardp.open_coupons()

        couponp.remove_coupon(coupon_setting.get('code'))
        self.assertTrue(couponp.is_success())
Beispiel #21
0
 def test_login(self):
     page = LoginPage(self.driver)
     page.get("http://testadmin.huxin315.com/user/login")
     self.driver.set_window_size(1936, 1056)
     page.server_button.click()
     page.server_selector.click()
     page.testServer_option.click()
     page.mobileLogin_button.click()
     page.mobile_input[0].click()
     page.mobile_input[0].send_keys("15176128570")
     page.verificationCode_input[1].send_keys("000000")
     page.login_button.click()
     sleep(5)
Beispiel #22
0
class TestLogin(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.driver.get("http://120.79.176.157:8012/Index/login.html")
        self.login_page = LoginPage(self.driver)

    def tearDown(self):
        self.driver.quit()

    def test_login_success(self):
        # 步骤
        self.login_page.login("18684720553", "python")
        # 验证-检查点
        # self.assertEqual(self.driver.current_url, "http://120.79.176.157:8012/Index/index")
        self.assertEqual(IndexPage(self.driver).get_nickName(), "我的帐户[小蜜蜂96027]")

    def test_login_noUser(self):
        self.login_page.login("     ", "python")
        self.assertEqual(self.login_page.no_user_prompt(), '请输入手机号')

    def test_login_wrongPasswd(self):
        self.login_page.login("18684720553", "python1234")
        self.assertEqual(self.login_page.user_passwd_error(), "帐号或密码错误!")
 def test_01_login(self):
     """登录"""
     login_po = LoginPage(self.driver)
     login_po.username_input('中文+Test+12345678')
     login_po.password_input('111111')
     sleep(2)
     login_po.login_button()
Beispiel #24
0
 def test_tech_login(self):
     """学生登录"""
     login_po = LoginPage(self.driver)
     login_po.username_input('h01')
     login_po.password_input('Hlf001')
     sleep(1)
     login_po.login_button()
Beispiel #25
0
 def setUp(self):
     chrome_options = Options()
     chrome_options.add_argument("--headless")
     # 登录
     self.driver = webdriver.Chrome(
         executable_path=(PD.driver_path),
         chrome_options=chrome_options)
     self.driver.maximize_window()
     self.driver.get(PD.login_url)
     self.bid_page = BidPage(self.driver)
     self.login_page = LoginPage(self.driver)
     self.index_page = IndexPage(self.driver)
     self.person_page = PersonPage(self.driver)
     self.login_page.login(PD.username, PD.password)
Beispiel #26
0
    def test_creat_tag(self):
        #arrange
        username = password = '******'
        tag_name = 'tag%s' %(time.time())

        #action
        login_page = LoginPage(self.dr, self.domain + 'wp-login.php')
        login_page.login(username, password)

        edit_tag_page = CreateTag(self.dr, self.domain +'wp-admin/edit-tags.php')
        edit_tag_page.create_tag(tag_name)

        #assert
        table = edit_tag_page.tag_link().text
        self.assertIn(tag_name,table)
Beispiel #27
0
    def testLoginThenLogoutCorrectlyResetsState(self):
        """Test restricted pages redirects to login after logout."""
        # Login first with a valid user.
        LoginPage(self.driver).Login(self.args.server_url, self.args.email,
                                     self.args.password)

        # Assert that the login worked.
        landing_url = self.args.server_url + flask.url_for('landing')
        self.driver.get(landing_url)
        self.assertEquals(landing_url, self.driver.current_url)

        # Then log back out.
        LoginPage(self.driver).Logout(self.args.server_url)

        # Now test that the user is correctly redirected.
        self.assertHandlersRedirectToLoginPage()
Beispiel #28
0
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)
        width = self.winfo_screenwidth() // 4
        height = self.winfo_screenheight() // 4
        self.container = Frame(self, width=width, height=height)
        self.container.grid_propagate(False)
        self.container.pack(side=TOP, fill=BOTH, expand=True)
        self.container.grid_rowconfigure(0, weight=1)
        self.container.grid_columnconfigure(0, weight=1)

        self.frames = dict()

        frame = LoginPage(self.container, self)
        self.frames[LoginPage] = frame
        frame.grid(row=0, column=0, sticky=NSEW)
        self.show_frames(LoginPage)
Beispiel #29
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        # Switch to login page when the app starts with reference to page controller

        self.login_page = LoginPage(self)
        self.switch_to(self.login_page)
 def tearDown(self):
     """Teardown for test methods."""
     settings_component = SettingsComponent(self.driver)
     self.driver.get(self.args.server_url)
     settings_component.resetSettings(self.initial_settings)
     LoginPage(self.driver).Logout(self.args.server_url)
     super(SettingsComponentTest, self).tearDown()
    def test_when_logged_go_to_course_list_page(self):
        # create a professor with courses
        course = Course.objects.create(
            name="maths",
            start_date=timezone.now().date(),
            finish_date=timezone.now().date(),
        )
        professor = User.objects.create(username="******")
        password = "******"
        professor.set_password(password)
        professor.save()
        course.professors.add(professor)

        login_page = LoginPage(self.browser, root_uri=self.live_server_url)
        login_page.get("/login")
        login_page.username = professor.username
        login_page.password = password
        login_page.login.click()

        course_list_page = CourseListPage(self.browser, root_uri=self.live_server_url)
        # do not use page.get because is redirected in login
        course_list = course_list_page.course_list
        self.assertIn(course.name, course_list)
    def setUp(self):
        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, self.BROWSER).copy()
        )

        login_page = LoginPage(self.driver)
        login_page.open()

        login_form = login_page.form()
        login_form.set_email_name(self.EMAIL)
        login_form.set_password(self.PASSWORD)
        login_form.submit()

        self.compose_page = ComposePage(self.driver)
        self.compose_page.open()

        self.address_book_page = AddressBookPage(self.driver)
        self.address_book_add_page = AddressBookAddPage(self.driver)

        self.header_switcher = self.compose_page.header_switcher()
        self.header_switcher_dropdown_btn = self.header_switcher.get_dropdown_button()

        self.content_edit = self.compose_page.content_edit()
    def test_user_login(self):
        from login_page import LoginPage

        new_user = User(name=internet.user_name(), email=internet.email_address(), password=basic.text())
        db.session.add(new_user)
        db.session.commit()

        page = LoginPage(self.client)
        self.client.get("http://localhost:5000/auth/login")
        self.assertTrue(u"登录" in page.title)

        page.set_user_name(new_user.name)
        page.set_pwd(new_user.password)
        page.submit()

        # 返回注册结果

        self.assertTrue(re.search(u"欢迎来到Ray的博客", self.client.page_source))
Beispiel #34
0
    def test_user_login(self):
        from login_page import LoginPage
        new_user = User(name=internet.user_name(),
                        email=internet.email_address(),
                        password=basic.text())

        db.session.add(new_user)
        db.session.commit()

        page = LoginPage(self.client)
        self.client.get('http://localhost:5000/auth/login')
        self.assertTrue(u'登录' in self.client.title)

        page.set_user_name(new_user.name)
        page.set_user_password(new_user.password)
        page.submit()

        # return the login result

        self.assertTrue(re.search(u'欢迎来到Gregory的博客', self.client.page_source))
Beispiel #35
0
# coding:utf-8
from selenium import webdriver
from login_page import LoginPage, login_url
from login_sucess_page import LoginSucessPage, login_sucess_url
driver = webdriver.Firefox()

# 登录页面操作
driver_login = LoginPage(driver)
driver_login.open(login_url)
driver_login.login(u"上海-悠悠", "xxx")

# 登录成功页面操作
driver_sucess = LoginSucessPage(driver)
driver_sucess.input_sign("hao123")
driver_sucess.click_by_blog()
Beispiel #36
0
    # 仅负责定义操作,不负责校验操作结果,也不负责完成具体跟 test case 相关的逻辑
    # 不负责启动关闭浏览器实例
    def change_product_by_name(self, product):
        """
        """
        
        product_name = [t for t in self.drp_product_list.options if product.name in t.text]
        self.drp_product_list.select_by_visiable_text(product_name[0].text)

    def create_product(self):
        """ Function doc
    
        @param PARAM: DESCRIPTION
        @return RETURN: DESCRIPTION
        """
        self.lnk_create_product.click()


if __name__ == "__main__":
    from login_page import LoginPage
    from home_page import HomePage
    import sys
    sys.path.append("..")
    from test_data import accounts, products
    from selenium import webdriver
    b = webdriver.Chrome("/home/jackei/chromedriver")
    b.get("http://192.168.56.101/zentaopms/www/")
    login = LoginPage(b)
    login.do_login_as(accounts.super_usr)