def do_login(self, username, password, verifycode):
     Web.open_page()
     self.login.username_text().send_keys(username)
     self.login.password_text().send_keys(password)
     self.login.verifycode_text().send_keys(verifycode)
     self.login.login_button().click()
     time.sleep(1)
Beispiel #2
0
 def __init__(self, person=None, web=None) -> None:
     super(CharacterTest, self).__init__(person, web)
     self.person = person
     self.web = web or Web(randomize=1)
     self.fitness = 0
     Character.counter += 1
     Character.characters_all.append(self)
Beispiel #3
0
 def __init__(self,
              person: Person = None,
              web=None,
              default_position_range=None) -> None:
     self.person = person or Person(
         default_position_range=default_position_range)
     self.web = web or Web(randomize_power=1)
     self.fitness = 0
     self.adaptive_params = None  # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     Character.counter += 1
     Character.characters_all.append(self)
Beispiel #4
0
    def __init__(self, person=None, web=None):
        self.person = person

        if web != None: self.web = web
        else: self.web = Web(randomize=1)

        self.fitnes = 0
        self.fitnes_radical = 0

        Character.iterator += 1

        Character.characters_all.append(self)
 def test_login(self,version, module, type, case_id, case_title, case_data, expect):
     try:
         time.sleep(1)
         self.login.do_login(case_data["username"],case_data["password"],case_data["verifycode"])
         if expect == "注销":
             time.sleep(1)
             self.common.do_loginout()
             Web.write_result(version,module,type,case_id,case_title,"成功")
         elif expect == "fail":
             time.sleep(1)
             self.login.do_fail()
             Web.write_result(version, module, type, case_id, case_title, "成功")
         else:
             Web.write_result(version, module, type, case_id, case_title, "失败",error="断言失败")
     except Exception as e:
         massage = str(e)
         Web.write_result(version, module, type, case_id, case_title, "失败",error=massage)
Beispiel #6
0
    def _character_init(self) -> None:
        self.character = []
        for i in range(self.genetic_algorithm_params._start_population):
            position = []
            for j in range(self.genetic_algorithm_params.get_dimension()):
                position.append(
                    random.randint(self.start_pos[j // 2][j % 2],
                                   self.end_pos[j // 2][j % 2]))

            web = Web(self.genetic_algorithm_params.get_web_layers(),
                      randomize_power=1)
            person = PersonTest(
                color=[
                    random.randint(10, 20),
                    random.randint(0, 50),
                    random.randint(0, 50)
                ],  #[i * 80, i * 80, 100],
                position=position,
                size=10,  #5 + i * 5,
                default_position_range=[self.start_pos, self.end_pos])
            self.character.append(CharacterTest(person=person, web=web))
 def finish(self):
     time.sleep(2)
     Web.colse_browser()
 def prepare(self):
     try:
         Web.show_wait(By.ID,"username",timeout=15)
     except:
         Web.open_page()
Beispiel #9
0
 def __init__(self):
     self.driver = Web.get_driver()
Beispiel #10
0
 def login_fail_button(self):
     element = Web.show_wait(By.XPATH,
                             "/html/body/div[6]/div/div/div[3]/button")
     return element
Beispiel #11
0
 def verifycode_text(self):
     element = Web.show_wait(By.ID, "verifycode")
     element.clear()
     return element
Beispiel #12
0
 def password_text(self):
     element = Web.show_wait(By.ID, "password")
     element.clear()
     return element
Beispiel #13
0
 def username_text(self):
     element = Web.show_wait(By.ID, "username")
     element.clear()
     return element
Beispiel #14
0
 def loginout_link(self):
     element = Web.show_wait(By.PARTIAL_LINK_TEXT, "注销")
     return element