import time
import pytest
from selenium import webdriver
class Testlogin:
def setup_class(self):
self.driver=webdriver.Chrome()
self.driver.get('http://39.98.138.157/shopxo/index.php?s=/index/user/logininfo.html')
def test_01(self):
self.driver.find_element_by_name('accounts').send_keys('qiushui')
self.driver.find_element_by_name('pwd').send_keys('123456')
self.driver.find_element_by_xpath('/html/body/div[4]/div/div[2]/div[2]/form/div[3]/button').click()
self.driver.maximize_window()
def test_02(self):
self.driver.find_element_by_name('accounts').send_keys('qiushui2')
self.driver.find_element_by_name('pwd').send_keys('123456')
self.driver.find_element_by_xpath('/html/body/div[4]/div/div[2]/div[2]/form/div[3]/button').click()
self.driver.maximize_window()
def teardown_class(self):
time.sleep(5)
self.driver.quit()
if __name__ == '__main__':
pytest.main(['-vs','test_login.py'])
文章评论