#coding=utf-8
importunittest
fromseleniumimportwebdriver
classautocheck(unittest.TestCase):
defsetUp(self):
self.driver=webdriver.Chrome()
deftest_serch_in_python_org(self):
driver=self.driver
driver.get("https://shequ.ghzq.com.cn/h5/html/regist.html")
self.assertIn("",driver.title)
elem=driver.find_element_by_xpath("//*[@id=\"view1\"]/div[2]/a").click()#"号要转义,在前面加个\
elem=driver.find_element_by_xpath("//*[@id=\"phone\"]").send_keys()
elem=driver.find_element_by_xpath("//*[@id=\"password\"]").send_keys("~~")
elem=driver.find_element_by_xpath("/html/body/div[1]/div[2]/a").click()
self.assertIn("竞技场",driver.title )
deftearDown(self):
self.driver.close()
if__name__=="__main__":
unittest.main()
网友评论