Beispiel #1
0
 def ie_driver(self):
     try:
         driver = webdriver.Chrome(self.full_driver_name, options=chrome_options)
         return driver
     except:
         msg = "드라이버 경로( {0} )에 {1}이(가) 없습니다 !!!".format(self.driver_path, self.driver_name)
         errmsg = Util.Errpop().critical_pop(msg)
Beispiel #2
0
    def web_login_pretest(self):
        add_idpw_dic = dict()
        # 1. id / pw placeholderText가 빠진경우
        if (self.web_id.placeholderText() == "ID입력요망"
                or self.web_id.placeholderText() == ""
                or self.web_pw.placeholderText() == "PW입력요망"
                or self.web_pw.placeholderText() == ""):

            return (False, False)
        # 2. id 입력했는데 pw 입력안한 경우
        elif ((self.add_idpw[0] != (None or ""))
              and (self.add_idpw[1] == (None or ""))):

            popup = Util.Errpop()
            msg = "<b>Password</b>를 입력 후 다시 로그인 해주세요!!!) "
            popup.critical_pop(msg)

            return (False, False)
        # 3. pw 만입력 id placeholderText 있는 경우
        elif ((self.add_idpw[0] == (None or ""))
              and (self.web_id.placeholderText() !=
                   ("ID입력요망" or "")) and (self.add_idpw[1] != (None or ""))):
            new_id = self.web_id.placeholderText()
            new_pw = self.add_idpw[1]
            add_idpw_dic['id'] = new_id
            add_idpw_dic['pw'] = new_pw

            return (True, add_idpw_dic)
        # 4.
        elif (self.add_idpw[0] != None and self.add_idpw[1] != None
              and self.add_idpw[0] != ""
              and self.add_idpw[1] != ""):  # id / pw 모두 입력
            new_id = self.add_idpw[0]
            new_pw = self.add_idpw[1]
            add_idpw_dic['id'] = new_id
            add_idpw_dic['pw'] = new_pw

            return (True, add_idpw_dic)

        # 5. (id / pw 가 모두 바뀜) or (placeholderText 유효 id,pw 모두 안 바뀜) or (placeholderText 유효한 상황에서 id, pw 중 하나 바뀜)
        elif (self.web_id.placeholderText() != "ID입력요망"
              and self.web_id.placeholderText() != ""
              and self.web_pw.placeholderText() != "PW입력요망"
              and self.web_pw.placeholderText() != ""):

            new_id = self.web_id.placeholderText()
            new_pw = self.web_pw.placeholderText()
            add_idpw_dic['id'] = new_id
            add_idpw_dic['pw'] = new_pw

            return (True, add_idpw_dic)
        # 6.
        else:
            return (False, False)
Beispiel #3
0
    def chrome_driver(self):
        try:
            # chrome_options = webdriver.ChromeOptions()
            chrome_options = Options()
            chrome_options.add_argument("disable-infobars")  # chrome이 자동화된 테스트 소프트웨어에 의해 제어되고 있습니다

            driver = webdriver.Chrome(self.full_driver_name, options=chrome_options)
            return driver
        except:
            msg = "드라이버 경로( {0} )에 {1}이(가) 없습니다 !!!".format(self.driver_path, self.driver_name)
            errmsg = Util.Errpop().critical_pop(msg)
Beispiel #4
0
def get_element(driver, attribute_value, attribute='id'):
    
    try:
        element = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.XPATH, f"//*[@{attribute}=\'{attribute_value}\']")))
        
        return element
    except Exception as e:
        app = QApplication(sys.argv)
        err_class_name = e.__class__.__name__
        msg = f"selenium id < {attribute_value} >에서 예외 < {err_class_name} >가 발생 하였습니다."
        errmsg = Util.Errpop().critical_pop(msg)
        sys.exit(app.exec_())
Beispiel #5
0
    def on_webgubun_activated(self, text):
        self.web_id.setPlaceholderText("")
        self.web_pw.setPlaceholderText("")
        self.web_id_cb.clear()

        if text == "email":
            self.web_cb.clear()
            self.web_cb.addItems(self.email_lst)
            text = self.web_cb.currentText()
            self.setup_web_widgets(text)
        elif text == "websites":
            self.web_cb.clear()
            self.web_cb.addItems(self.website_lst)
            text = self.web_cb.currentText()
            self.setup_web_widgets(text)

        elif text == "banks":
            self.web_cb.clear()
            popup = Util.Errpop()
            msg = "개발중...<br>comming soon..."
            popup.critical_pop(msg)
Beispiel #6
0
    def web_login_clicked(self):  # >>> web_login_pretest()로 분기
        is_idpw_flag, add_idpw_dic = self.web_login_pretest()
        # print("web_login_clicked >>> ", is_idpw_flag, add_idpw_dic)
        if is_idpw_flag == True:
            user_id = add_idpw_dic['id']
            user_pw = add_idpw_dic['pw']

            self.web_id.clear()
            self.web_pw.clear()
            self.web_id.setPlaceholderText(user_id)
            self.web_pw.setPlaceholderText(user_pw)

            select_website_str = self.web_cb.currentText()
            idpw_lst_of_dic = self.text_map_WebLstDic[select_website_str]
            key_lst, idpw_lst = jsconverter.lstOFdic_to_tupKeysVals(
                idpw_lst_of_dic)
            id_lst, pw_lst = self.cb_id_pw_list(idpw_lst_of_dic)
            # 최초 입력시 빈리스트 인 경우
            if len(idpw_lst_of_dic) == 0:
                self.text_map_WebLstDic[select_website_str].insert(
                    0, add_idpw_dic)  # 제일 앞으로
                jsconverter.dict_to_json(web_dict,
                                         FULLPATH_WEB_JSON)  # update json file
                # 2. Signal(json_update_signal) emit
                self.json_update_signal.emit()
                self.web_id_cb.clear()
                self.web_id_cb.addItem(user_id)
            else:
                # id 유무 확인하여 pw 만 업데이트
                if user_id in id_lst:  # 동일 id 있으면
                    idx = id_lst.index(user_id)  # index 구하기
                    # pw 일치 확인
                    if user_pw == pw_lst[idx]:  # pw 동일하면 즉시 로그인
                        pop_idpw = idpw_lst.pop(idx)  # json file 순서교체를 위해
                        idpw_lst.insert(0, pop_idpw)  # json file 순서교체를 위해
                        self.text_map_WebLstDic[
                            select_website_str] = jsconverter.lstOFlst_to_lstOFdic(
                                key_lst, idpw_lst)  #######
                        web_dict['idpw'][
                            select_website_str] = self.text_map_WebLstDic[
                                select_website_str]
                        jsconverter.dict_to_json(
                            web_dict, FULLPATH_WEB_JSON)  # update json file

                    elif user_pw != pw_lst[idx]:  # pw 다르면 업데이트 후 로그인
                        idpw_lst[idx][0] = user_id
                        idpw_lst[idx][1] = user_pw

                        pop_idpw = idpw_lst.pop(idx)  # json file 순서교체를 위해
                        idpw_lst.insert(0, pop_idpw)  # json file 순서교체를 위해
                        self.text_map_WebLstDic[
                            select_website_str] = jsconverter.lstOFlst_to_lstOFdic(
                                key_lst, idpw_lst)  #######
                        web_dict['idpw'][
                            select_website_str] = self.text_map_WebLstDic[
                                select_website_str]
                        jsconverter.dict_to_json(
                            web_dict, FULLPATH_WEB_JSON)  # update json file

                else:  # 동일 id 없으면
                    self.text_map_WebLstDic[select_website_str].insert(
                        0, add_idpw_dic)  # 제일 앞으로
                    jsconverter.dict_to_json(
                        web_dict, FULLPATH_WEB_JSON)  # update json file
                    id_lst.insert(0, user_id)

                    self.web_id_cb.clear()
                    self.web_id_cb.addItems(id_lst)

            if select_website_str == "Naver":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                naver = website.NaverMail(user_id, user_pw)
                naver.clipboard_login(naver.ID, naver.PW)

            elif select_website_str == "Hanbiro":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                hanbiro = website.Hanbiro(user_id, user_pw)
                hanbiro.login(hanbiro.ID, hanbiro.PW)

            elif select_website_str == "nate":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                nate = website.Nate(user_id, user_pw)
                nate.login(nate.ID, nate.PW)

            elif select_website_str == "daum":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                daum = website.Daum(user_id, user_pw)
                daum.login(daum.ID, daum.PW)

            elif select_website_str == "bizforms":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                bizforms = website.Bizforms(user_id, user_pw)
                bizforms.login(bizforms.ID, bizforms.PW)

            elif select_website_str == "etaxkorea":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                etaxkorea = website.Etaxkorea(user_id, user_pw)
                etaxkorea.login(etaxkorea.ID, etaxkorea.PW)

            elif select_website_str == "TheBill":
                user_id = self.web_id.placeholderText()
                user_pw = self.web_pw.placeholderText()
                theBill = website.TheBill(user_id, user_pw)
                theBill.login(theBill.ID, theBill.PW)

            # combobox 순서 변경
            select_web_gubun = self.web_gubun_cb.currentText()
            select_web_gubun_idx = web_dict['gubun'].index(select_web_gubun)
            pop_web_gubun = web_dict['gubun'].pop(select_web_gubun_idx)
            web_dict['gubun'].insert(0, pop_web_gubun)

            select_web_site = self.web_cb.currentText()
            if select_web_site in web_dict['email']:
                select_web_site_idx = web_dict['email'].index(select_web_site)
                pop_web_site = web_dict['email'].pop(select_web_site_idx)
                web_dict['email'].insert(0, pop_web_site)
            elif select_web_site in web_dict['websites']:
                select_web_site_idx = web_dict['websites'].index(
                    select_web_site)
                pop_web_site = web_dict['websites'].pop(select_web_site_idx)
                web_dict['websites'].insert(0, pop_web_site)

            jsconverter.dict_to_json(web_dict,
                                     FULLPATH_WEB_JSON)  # update json file
            # 2. Signal(json_update_signal) emit
            self.json_update_signal.emit()
            ##
        else:
            popup = Util.Errpop()
            msg = "<b>ID / PW</b>를 선택(입력)후 다시 로그인 해주세요!!!) "
            popup.critical_pop(msg)