def test_grade(self): enter_subform(self._driver, self._linklab_url) time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "ant-tree-switcher")[2].click() time.sleep(1) wait_and_find_elements_by_class_name( self._driver, "formNav-title-pathname")[9].click() wait_and_find_element_by_xpath(self._driver, "//a[@title='选项2']").click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[0].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[1].click() commit_presence(self._driver, '打分题')
def test_load_file(self): # file_path = "/Users/QA/PycharmProjects/linklab_test/1.png" enter_subform(self._driver, self._linklab_url) wait_and_find_elements_by_class_name(self._driver, "ant-tree-switcher")[2].click() time.sleep(1) wait_and_find_elements_by_class_name( self._driver, "formNav-title-pathname")[8].click() wait_and_find_elements_by_xpath( self._driver, "//input[@type='file']")[1].send_keys(file_path) time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[0].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[1].click() commit_presence(self._driver, '文件题')
def submit(self, position): login(self._driver, self._linklab_url, TEST_JYB_ONLINE) self._driver.get(self._linklab_url + '/project/user/#/') wait_and_find_elements_by_link_text(self._driver, '进入项目')[position].click() wait_and_find_elements_by_class_name(self._driver, 'navItem-title')[2].click() wait_and_find_elements_by_class_name(self._driver, 'collect_modules')[0].click() all_hand = self._driver.window_handles self._driver.switch_to.window(all_hand[-1]) time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "ant-tree-switcher")[2].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "formNav-title-pathname")[2].click() wait_and_find_elements_by_class_name(self._driver, "defLabel")[5].click() wait_and_find_elements_by_class_name(self._driver, "defLabel")[7].click() wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[0].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[1].click() commit_presence(self._driver, '单选题')
def creat_subject(self, position): login(self._driver, self._linklab_url, TEST_JYB_ONLINE) self._driver.get(self._linklab_url + '/project/user/#/') wait_and_find_elements_by_link_text(self._driver, '进入项目')[position].click() wait_and_find_elements_by_class_name(self._driver, 'navItem-title')[2].click() wait_and_find_elements_by_link_text(self._driver, '新增案例')[0].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, 'ant-select-enabled')[1].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, 'ant-select-dropdown-menu-item')[0].click() wait_and_find_element_by_xpath(self._driver, '/html/body/div[2]/div/div[2]/div/div[1]/div[3]/div/button[2]').click() subject_name = datetime.datetime.now().strftime('%Y%m%d%H%M%S') all_hand = self._driver.window_handles self._driver.switch_to.window(all_hand[-1]) wait_and_find_element_by_tag_name(self._driver, 'input').send_keys(subject_name) wait_and_find_elements_by_class_name(self._driver, 'modal-confirm')[1].click() commit_presence(self._driver, "新建案例")
def test_address(self): enter_subform(self._driver, self._linklab_url) wait_and_find_elements_by_class_name(self._driver, "ant-tree-switcher")[2].click() time.sleep(1) wait_and_find_elements_by_class_name( self._driver, "formNav-title-pathname")[10].click() wait_and_find_elements_by_class_name(self._driver, "ant-cascader-input")[0].click() time.sleep(1) wait_and_find_element_by_xpath(self._driver, "//li[@title='北京市']").click() wait_and_find_element_by_xpath(self._driver, "//li[@title='北京辖区']").click() wait_and_find_element_by_xpath(self._driver, "//li[@title='昌平区']").click() wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[1].click() commit_presence(self._driver, '地址题')
def test_single_choice(self): enter_subform(self._driver, self._linklab_url) wait_and_find_elements_by_class_name(self._driver, "ant-tree-switcher")[2].click() time.sleep(1) wait_and_find_elements_by_class_name( self._driver, "formNav-title-pathname")[2].click() wait_and_find_elements_by_class_name(self._driver, "defLabel")[5].click() wait_and_find_elements_by_class_name(self._driver, "defLabel")[7].click() wait_and_find_elements_by_class_name(self._driver, "anticon-down")[0].click() wait_and_find_elements_by_class_name(self._driver, "defLabel")[12].click() wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[0].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[1].click() commit_presence(self._driver, '单选题')
def test_all_subject(self): # file_path = "/Users/jin/Desktop/4.png" enter_subform(self._driver, self._linklab_url) wait_and_find_elements_by_class_name(self._driver, "ant-tree-switcher")[2].click() time.sleep(1) wait_and_find_elements_by_class_name( self._driver, "formNav-title-pathname")[3].click() time.sleep(1) wait_and_find_elements_by_class_name(self._driver, "anticon-down")[0].click() wait_and_find_elements_by_class_name(self._driver, "defLabel")[2].click() wait_and_find_elements_by_class_name(self._driver, "selectText")[0].click() wait_and_find_elements_by_class_name( self._driver, "opentext-input")[1].send_keys(u"你好") wait_and_find_elements_by_class_name( self._driver, "opentext-input")[2].send_keys("10.2") wait_and_find_elements_by_class_name(self._driver, "time-set-input")[0].click() time.sleep(1) wait_and_find_element_by_class_name(self._driver, "date-now").click() wait_and_find_elements_by_class_name( self._driver, "ant-pagination-item-link")[1].click() wait_and_find_element_by_xpath(self._driver, "//a[@title='选项2']").click() wait_and_find_element_by_class_name(self._driver, "ant-cascader-input").click() wait_and_find_element_by_xpath(self._driver, "//li[@title='北京市']").click() wait_and_find_element_by_xpath(self._driver, "//li[@title='北京辖区']").click() wait_and_find_element_by_xpath(self._driver, "//li[@title='昌平区']").click() wait_and_find_elements_by_class_name(self._driver, "modal-confirm")[1].click() commit_presence(self._driver, '所有点位')