Beispiel #1
0
    def test_login(self):
        '''密码登录'''
        print('start')
        driver = Pyse("chrome")
        try:
            driver.open(
                "http://172.17.0.200:8066/Directors/pages/login.html?_U155834476961480222"
            )

            time.sleep(3)

            driver.type(r"xpath=>//*[@name='userName']", "test1")

            driver.type(r"name=>password", "admin")

            time.sleep(2)

            driver.click(r"id=>btnSubmit")

            # time.sleep(50)
            print("等进去")
            time.sleep(30)
            print("ddddddddddd")
            print('end')
        except BaseException as err:
            print(err)
Beispiel #2
0
def test_baidu():
    """ baidu search key : pyse """
    driver = Pyse("chrome")
    driver.open("https://www.baidu.com")
    driver.type("id=>kw", "pyse")
    driver.click("css=>#su")
    sleep(1)
    assert "pyse" in driver.get_title()
    driver.quit()
Beispiel #3
0
 def setUp(self):
     self.driver = Pyse('chrome')
     self.driver.open(
         'http://t4567.xyscm-biz-warehouse-web.yunzong:12370/#/login')
     self.driver.max_window()
     self.driver.type('class=>userName', 'yxadmin1')
     time.sleep(1)
     self.driver.type('class=>password', 'y123456')
     time.sleep(1)
     self.driver.click('class=>button')
Beispiel #4
0
def test_baidu():
    ''' baidu search key : pyse '''
    driver = Pyse("chrome")
    driver.open("https://www.baidu.com")
    driver.type("id=>kw", "pyse")
    driver.click("id=>su")
    sleep(1)
    title = driver.get_title()
    assert "pyse" in title
    driver.quit()
Beispiel #5
0
 def setUp(self):
     self.driver = Pyse('chrome')
     self.driver.open(
         'http://t5609.xyscm-biz-manager-web.yunzong:12050/#/login')
     self.driver.max_window()
     self.driver.type('class=>userName', 'yangxuegx')
     time.sleep(0.5)
     self.driver.type('class=>password', 'y123456')
     time.sleep(0.5)
     self.driver.click('class=>button')
     time.sleep(1)
Beispiel #6
0
def test_youdao():
    ''' youdao search key : pyse '''
    driver = Pyse()   # default firefox browser
    driver.open("http://www.youdao.com")
    driver.type("name=>q", "pyse")
    driver.click("id=>qb")
    sleep(1)
    title = driver.get_title()
    print title
    assert title == "pyse - 有道搜索"
    driver.quit()
Beispiel #7
0
def main():
    try:
        driver = Pyse("chrome")
        username = '******'
        password = '******'
        test_user_login(driver, username, password)
        sleep(3)
        text = driver.get_text("//span[@id='spnUid']")
        assert(text == '*****@*****.**'),u"用户名称不匹配,登录失败!"
    finally:
        # 关闭浏览器窗口
        driver.close()
Beispiel #8
0
def main():
    try:
        driver = Pyse("chrome")
        username = '******'
        password = '******'
        test_user_login(driver, username, password)
        sleep(3)
        text = driver.get_text("//span[@id='spnUid']")
        assert (text == '*****@*****.**'), u"用户名称不匹配,登录失败!"
    finally:
        # 关闭浏览器窗口
        driver.close()
Beispiel #9
0
 def test_case(self):
     ''' test key : pyse '''
     self.driver = Pyse("chrome")
     driver = self.driver
     driver.open("http://www.baidu.com")
     driver.type("//*[@id='kw']", "pyse")
     driver.click("//*[@id='su']")
     sleep(1)
Beispiel #10
0
class baiduTest(unittest.TestCase):
    def setUp(self):
        self.driver = Pyse("chrome")
        self.driver.wait(10)
        self.base_url = "http://www.baidu.com"

    def test_case(self):
        driver = self.driver
        driver.open(self.base_url)
        driver.click_text("设置")
        driver.click_text("搜索设置")
        sleep(2)
        driver.click("//a[@class='prefpanelgo']")
        sleep(1)
        driver.accept_alert()

    def tearDown(self):
        self.driver.quit()
Beispiel #11
0
class baiduTest(unittest.TestCase):

    def setUp(self):
        self.driver = Pyse("chrome")
        self.driver.wait(10)
        self.base_url = "http://www.baidu.com"

    def test_case(self):
        driver = self.driver
        driver.open(self.base_url)
        driver.click_text("设置")
        driver.click_text("搜索设置")
        sleep(2)
        driver.click("//a[@class='prefpanelgo']")
        sleep(1)
        driver.accept_alert()

    def tearDown(self):
        self.driver.quit()
Beispiel #12
0
class TestLogin:
    '''test login '''
    def setup(self):
        self.driver = Pyse("chrome")
        self.base_url = "http://www.126.com"

    def teardown(self):
        self.driver.quit()

    def test_login(self):
        ''' test mail login : admin ,123456 '''
        driver = self.driver
        driver.open(self.base_url)
        driver.switch_to_frame("xpath=>//*[@id='loginDiv']/iframe")
        driver.type("name=>email", "admin")
        driver.type("name=>password", "123456")
        driver.click("id=>dologin")
        sleep(3)
        user_name = driver.get_text("id=>spnUid")
        assert user_name == "*****@*****.**"
Beispiel #13
0
class TestLogin:
    '''test login '''

    def setup(self):
        self.driver = Pyse("chrome")
        self.base_url = "http://www.126.com"

    def teardown(self):
        self.driver.quit()

    def test_login(self):
        ''' test mail login : admin ,123456 '''
        driver = self.driver
        driver.open(self.base_url)
        driver.switch_to_frame("xpath=>//*[@id='loginDiv']/iframe")
        driver.type("name=>email", "admin")
        driver.type("name=>password", "123456")
        driver.click("id=>dologin")
        sleep(3)
        user_name = driver.get_text("id=>spnUid")
        assert user_name == "*****@*****.**"
Beispiel #14
0
def test_baidu():
  ''' baidu search key : pyse '''
  driver = Pyse("chrome")
  # driver.open("https://www.baidu.com")
  driver.open("http://10.1.0.52/middlecas/login?service=http://10.1.0.52:8080/middleresource/shiro-cas")
  # driver.type("id=>kw","pyse")
  # driver.click("css=>#su")
  sleep(1)
  assert "pyse" in driver.get_title()
  driver.quit()
Beispiel #15
0
 def setUpClass(cls):
     ''' Setting browser driver, Using chrome by default.'''
     cls.driver = Pyse("firefox")
Beispiel #16
0
class testwarehouseinner(unittest.TestCase):
    def setUp(self):
        self.driver = Pyse('chrome')
        self.driver.open(
            'http://t4567.xyscm-biz-warehouse-web.yunzong:12370/#/login')
        self.driver.max_window()
        self.driver.type('class=>userName', 'yxadmin1')
        time.sleep(1)
        self.driver.type('class=>password', 'y123456')
        time.sleep(1)
        self.driver.click('class=>button')

    def tearDown(self):
        self.driver.close()

    def test1(self):
        self.driver.click(
            'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[4]/div/span')
        time.sleep(1)
        self.driver.click(
            'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[4]/ul/li[3]/span'
        )
        time.sleep(1)
        self.driver.click(
            'xpath=>//*[@id="content"]/div[2]/div[1]/button/span')  #点击新增
        time.sleep(1)
        self.driver.click(
            'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[1]/div/div/div/span/span/i'
        )  #点击下拉框
        time.sleep(1)
        self.driver.click(
            'xpath=>/html/body/div[3]/div[1]/div[1]/ul/li[2]/span')
        time.sleep(1)
        self.driver.type(
            'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[2]/div/div[1]/input',
            'test1')
        time.sleep(1)
        self.driver.type(
            'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[3]/div/div[1]/input',
            'test001')
        time.sleep(1)
        self.driver.click(
            'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[4]/div/div/div/input'
        )
        time.sleep(1)
        self.driver.click(
            'xpath=>/html/body/div[4]/div[1]/div[1]/ul/li[1]/span')
        time.sleep(1)
        self.driver.click(
            'xpath=>//*[@id="content"]/div[2]/div[2]/div/div[2]/form/div[5]/div/button'
        )
        time.sleep(4)
Beispiel #17
0
    driver.save_screenshot('login/login.png')  #截取登录页面
    imgSize = codeEelement.size  #获取验证码图片的大小
    imgLocation = imgElement.location  #获取验证码元素坐标
    rangle = (int(imgLocation['x']), int(imgLocation['y']),
              int(imgLocation['x'] + imgSize['width']),
              int(imgLocation['y'] + imgSize['height']))  #计算验证码整体坐标
    login = Image.open("login/login.png")
    frame4 = login.crop(rangle)  #截取验证码图片
    frame4.save('login/authcode.png')
    authcodeImg = Image.open('login/authcode.png')
    authCodeText = pytesseract.image_to_string(authcodeImg).strip()
    return authCodeText


if __name__ == '__main__':

    driver = Pyse("chrome")
    try:
        driver.get('http://172.17.0.200/login')
        # driver.maximize_window()
        time.sleep(2)
        imgElement = driver.find_element_by_id('codeImg')
        authCodeText = get_auth_code(driver, imgElement)
        time.sleep(2)
        print("code: " + authCodeText)
    except BaseException as e:
        print(e)

    finally:

        driver.quit()
Beispiel #18
0
 def setUp(self):
     self.driver = Pyse("chrome")
Beispiel #19
0
class BaiduTest(unittest.TestCase):
    ''' Baidu serach test case '''
    def setUp(self):
        self.driver = Pyse("chrome")

    def tearDown(self):
        self.driver.quit()

    def baidu_search(self, search_key):
        self.driver.open("https://www.baidu.com")
        self.driver.clear("id=>kw")
        self.driver.type("id=>kw", search_key)
        self.driver.click("css=>#su")
        # sleep(1)

    def test_baidu1(self):
        ''' baidu search key : pyse '''
        search_key = "pyse"
        self.baidu_search(search_key)
        self.assertTrue(search_key, self.driver.get_title())
Beispiel #20
0
 def setUp(self):
     self.driver = Pyse("chrome")
Beispiel #21
0
# coding=utf-8
from pyse import Pyse
from time import sleep

driver = Pyse("chrome")

driver.open("https://www.baidu.com")
driver.type("[name='wd']", u"pyse自动化测试")
driver.click("#kw")
sleep(2)
driver.quit()
Beispiel #22
0
# coding=utf-8
from pyse import Pyse, TestRunner
from nose.tools import with_setup
from time import sleep


def my_setup_function():
    print "test case start:"


def my_teardown_function():
    print "test case end."


@with_setup(my_setup_function, my_teardown_function)
def test02():
	''' testsearch '''
driver = Pyse("chrome")
driver.open("http://tb2c.qicolor.cn")
driver.type("xpath=>.//*[@id='keywords']", u"包")
driver.click("xpath=>html/body/div[2]/div[3]/div/div[1]/div/input[2]")
sleep(3)
driver.quit()



if __name__ == '__main__':
    TestRunner().run()
Beispiel #23
0
 def setup(self):
     self.driver = Pyse("chrome")
     self.base_url = "http://www.126.com"
Beispiel #24
0
def test_youdao():
    ''' youdao search key : pyse '''
    driver = Pyse()  # default firefox browser
    driver.open("http://www.youdao.com")
    driver.type("name=>q", "pyse")
    driver.click("id=>qb")
    sleep(1)
    title = driver.get_title()
    print title
    assert title == "pyse - 有道搜索"
    driver.quit()
Beispiel #25
0
    def sendEmail(self, subject="cctv"):
        start = time.time()
        driver = Pyse("chrome")
        try:

            # driver.implicitly_wait() # 添加了隐式等待,去除time.sleep显示等待
            # driver.max_window()
            driver.open("http://mail.10086.cn/")

            time.sleep(3)
            driver.element_wait(r"name=>UserName", 10)
            driver.element_wait(r"id=>loginBtn", 10)

            driver.clear("name=>UserName")
            driver.type("name=>UserName", self.username)

            driver.type("id=>txtPass", self.pwd)
            driver.click("id=>loginBtn")

            time.sleep(1)
            driver.click("name=>mailbox_1")

            # 收件箱
            driver.element_wait(r"xpath=>//*[@id='divTab']/ul/li[1]/span", 10)
            driver.element_wait(r"xpath=>//*[@id='sub']", 10)

            time.sleep(3)
            print("点击写信页: %r" %
                  driver.get_display(r"xpath=>//a[@id='btn_compose']"))
            driver.click(r"xpath=>//a[@id='btn_compose']")

            time.sleep(3)
            print('切换frame: %r' % driver.get_display(
                r"xpath=>//*[@id='compose_preload' and @class='main-iframe']"))
            driver.switch_to_frame(
                r"xpath=>//*[@id='compose_preload' and @class='main-iframe']")

            time.sleep(2)
            print('输入收件人: %r' % driver.get_display(
                r"xpath=>//*[@id='toContainer']/div/div[2]/div[2]/input"))
            driver.type(
                r"xpath=>//*[@id='toContainer']/div/div[2]/div[2]/input",
                self.receiver)

            time.sleep(3)
            print('输入主题: %r' %
                  driver.get_display(r"xpath=>//input[@id='txtSubject']"))
            # driver.click(r"xpath=>//input[@id='txtSubject']")
            driver.type(r"xpath=>//input[@id='txtSubject']", subject)

            print('点击发送')
            driver.click("id=>topSend")

            #             print('等待完成')
            #             driver.element_wait(r"xpath=>//*[@id='snedStatus']", 10)
            start = time.time()
            time.sleep(1)

        except BaseException as e:
            print('运行出错!!!')

            # driver.get_windows_img(r"D:\%s.jpg " %(start))
            print(e)
        finally:
            driver.quit()
            return start
Beispiel #26
0
def test_baidu():
    ''' baidu search key : pyse '''
    driver = Pyse("chrome")
    driver.open("https://www.baidu.com")
    driver.type("id=>kw", "pyse")
    driver.click("id=>su")
    sleep(1)
    title = driver.get_title()
    assert "pyse" in title
    driver.quit()
Beispiel #27
0
    def test_book_meeting(self):
        ''' 
		book meeting room
		'''
        email = 'bjzhangjiwei'
        passwd = 'Zjw163163'

        date = self.get_date()
        if date is None: return
        driver = Pyse("chrome")
        driver.max_window()

        #login
        driver.open("http://meeting.oa.netease.com/oaMeeting/login.jsp#login")
        while not driver.get_display("class=>email-suffix"):
            driver.click_text(u"邮箱登录")
        driver.clear("name=>loginid")
        driver.type("name=>loginid", email)
        driver.clear("name=>userpassword")
        driver.type("name=>userpassword", passwd)
        driver.click_text(u"立即登录")
        sleep(3)
        self.assertEqual(
            "http://meeting.oa.netease.com/oaMeeting/bjroom.jsp#home/city",
            driver.get_url())

        #输入筛选条件
        '''
		js = "document.getElementsByClassName('ac_selectCalendar')[0].getAttribute('value')"
		driver.js(js)
		today = driver.get_attribute("name=>date", 'value')
		tomorrow = today.split('-')[:2] + [str(int(today.split('-')[2]) + 1)]
		tomorrow = '-'.join(tomorrow)
		'''
        js = "document.getElementsByName('date')[0].setAttribute('value', '" + date + "')"
        driver.js(js)
        sleep(2)
        driver.click('class=>ac_settingFloor')
        sleep(1)
        driver.click(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[4]/div[1]/div[2]/ul/li[7]"
        )
        sleep(1)
        driver.click("class=>ac_interactiveConfirm")
        sleep(2)

        #选择上午会议室
        driver.click(
            'xpath=>//html/body/div[3]/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[3]/div/dl[1]/dd/ul/li[6]'
        )
        driver.click(
            'xpath=>//html/body/div[3]/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[3]/div/dl[1]/dd/ul/li[3]'
        )
        driver.click(
            'xpath=>//html/body/div[3]/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[4]/a'
        )
        sleep(2)
        driver.click(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[4]/div/dl[4]/dd/div"
        )
        while not driver.get_display(
                "xpath=>//*[@id='neteaseUser']/div/div[3]/div[2]/div/div[1]/div/div[1]/ul/li[1]/strong"
        ):
            sleep(2)
        driver.double_click(
            "xpath=>//*[@id='neteaseUser']/div/div[3]/div[2]/div/div[1]/div/div[1]/ul/li[8]/strong"
        )
        driver.click(
            "xpath=>//*[@id='jq-interactive-MultiNeteaseUser']/table/tbody/tr[2]/td[2]/div/div[5]/em[1]/a"
        )
        driver.type(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[4]/div/dl[5]/dd/input",
            'Regular meeting')
        driver.click(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[5]/em[1]/a"
        )
        sleep(3)

        #选择下午会议室
        driver.click(
            'xpath=>//html/body/div[3]/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[3]/div/dl[2]/dd[1]/ul/li[6]'
        )
        driver.click(
            'xpath=>//html/body/div[3]/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[3]/div/dl[2]/dd[1]/ul/li[3]'
        )
        driver.click(
            'xpath=>//html/body/div[3]/div[2]/div/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[4]/a'
        )
        sleep(2)
        driver.click(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[4]/div/dl[4]/dd/div"
        )
        while not driver.get_display(
                "xpath=>//*[@id='neteaseUser']/div/div[3]/div[2]/div/div[1]/div/div[1]/ul/li[1]/strong"
        ):
            sleep(2)
        driver.double_click(
            "xpath=>//*[@id='neteaseUser']/div/div[3]/div[2]/div/div[1]/div/div[1]/ul/li[8]/strong"
        )
        driver.click(
            "xpath=>//*[@id='jq-interactive-MultiNeteaseUser']/table/tbody/tr[2]/td[2]/div/div[5]/em[1]/a"
        )
        driver.type(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[4]/div/dl[5]/dd/input",
            'Regular meeting')
        driver.click(
            "xpath=>//*[@id='jq-interactive-sprite']/table/tbody/tr[2]/td[2]/div/div[5]/em[1]/a"
        )
        sleep(3)

        #验证预定成功
        self.assertTrue(driver.get_display("class=>mine-booked"))
        driver.click("xpath=>//html/body/div[3]/div[1]/div[2]/a[2]")
        sleep(2)
        self.assertEqual(
            "http://meeting.oa.netease.com/oaMeeting/bjroom.jsp#mine",
            driver.get_url())
        driver.driver.get_screenshot_as_file('meeting.jpg')
        #js =" var str = ''; var arr = document.getElementsByClassName('time-item');for (var i in arr){str += arr[i].innerHTML;}"
        #print str(driver.js(js))
        row_len = len(
            driver.driver.find_elements_by_xpath(
                "//html/body/div[3]/div[2]/div/div/div/div[2]/table/tbody/tr"))
        datetime = ''
        for i in range(1, row_len + 1):
            datetime += driver.get_element(
                'xpath=>//html/body/div[3]/div[2]/div/div/div/div[2]/table/tbody/tr[%d]/td[4]'
                % i).text.encode('utf-8')
        self.assertTrue(date in datetime)

        driver.quit()
Beispiel #28
0
class uiRecover(unittest.TestCase):
    def setUp(self):
        self.driver = Pyse('chrome')
        self.driver.open(
            'http://t5609.xyscm-biz-manager-web.yunzong:12050/#/login')
        self.driver.max_window()
        self.driver.type('class=>userName', 'yangxuegx')
        time.sleep(0.5)
        self.driver.type('class=>password', 'y123456')
        time.sleep(0.5)
        self.driver.click('class=>button')
        time.sleep(1)

    def tearDown(self):
        self.driver.close()

    def test_add_customer(self):
        self.driver.click(
            'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[7]/div/span'
        )  #点击客户管理,弹出下拉框
        time.sleep(0.5)
        self.driver.ciick(
            'xpath=>/html/body/div/div[2]/div[1]/div/div/ul/li[7]/ul/li[1]/span'
        )  #点击客户列表
        time.sleep(0.5)
        self.driver.click(
            'xpath=>//*[@id="content"]/div[2]/div[2]/button/span')  #点击新增客户
        time.sleep(0.5)
        self.driver.type(
            'xpath=>//*[@id="content"]/div[2]/form/div[1]/div[1]/div[1]/div/div/div/input',
            '自动测试客户一')  #输入客客户名称
        time.sleep(0.5)
        self.driver.type(
            'xpath=>//*[@id="content"]/div[2]/form/div[1]/div[1]/div[2]/div/div/div/input',
            '自动执行业务员一')  #输入业务员名称
        time.sleep(0.5)
Beispiel #29
0
 def setUpClass(cls):
     cls.driver = Pyse("firefox")
Beispiel #30
0
 def setUpClass(cls):
     """ Setting browser driver, Using chrome by default."""
     cls.driver = Pyse("chrome")
     cls.timeout = 15  # You can customize timeout time
Beispiel #31
0
class BaiduTest(unittest.TestCase):
    ''' Baidu serach test case '''

    def setUp(self):
        self.driver = Pyse("chrome")

    def tearDown(self):
        self.driver.quit()
    
    def baidu_search(self,search_key):
        self.driver.open("https://www.baidu.com")
        self.driver.clear("id=>kw")
        self.driver.type("id=>kw", search_key)
        self.driver.click("css=>#su")
        sleep(1)

    def test_baidu1(self):
        ''' baidu search key : pyse '''
        search_key = "pyse"
        self.baidu_search(search_key)
        self.assertTrue(search_key,self.driver.get_title())

    def test_baidu2(self):
        ''' baidu search key : selenium '''
        search_key = "selenium"
        self.baidu_search(search_key)
        self.assertTrue(search_key,self.driver.get_title())
Beispiel #32
0
 def test_baidu(self):
     ''' baidu search key : pyse '''
     driver = Pyse("chrome")
     driver.open("https://www.baidu.0com/")
     driver.clear("id=>kw")
     driver.type("id=>kw", "pyse")
     driver.click("css=>#su")
     sleep(1)
     self.assertTrue("pyse", driver.get_title())
     driver.quit()
Beispiel #33
0
 def test_baidu(self):
     ''' baidu search key : pyse '''
     driver = Pyse("chrome")
     driver.open("https://www.baidu.com")
     driver.clear("id=>kw")
     driver.type("id=>kw", "pyse")
     driver.click("css=>#su")
     sleep(1)
     self.assertTrue("pyse",driver.get_title())
     driver.quit()
Beispiel #34
0
#coding=utf-8
from pyse import Pyse
from time import sleep

driver = Pyse("chrome")

driver.open("https://ww.baidu.com")
driver.type("//*[@id='kw']",u"pyse自动化测试")
driver.click("//*[@id='su']")
sleep(2)
driver.quit()
Beispiel #35
0
#coding=utf-8
from pyse import Pyse
from time import sleep
driver = Pyse("chrome")
driver.open("https://www.baidu.com")
driver.clear("id=>kw")
#id定位
#driver.type("id=>kw", "pyse")
#name定位
#driver.type("name=>wd","pyse")
#link text定位:点击百度首页上面的“新闻”链接(有问题)
driver.click_text(u"link_text=>新闻")
#class定位
#driver.type("xpath=>//*[class='s_ipt']","pyse")
#xpath定位
#driver.type("xpath=>//*[@id='kw']","pyse")
#driver.click("xpath=>//*[@id='su']")
#css定位
#driver.type("css=>.s_ipt","pyse")
#driver.type("css=>#su","pyse")
#driver.click("css=>#su")
sleep(20)
#self.assertTrue("pyse",driver.get_title())
driver.quit()
Beispiel #36
0
 def setUpClass(cls):
     ''' Setting browser driver, Using chrome by default.'''
     cls.driver = Pyse("chrome_headless")
Beispiel #37
0
#coding=utf-8
from pyse import Pyse
from time import sleep

driver = Pyse("chrome")

driver.open("https://www.baidu.com")
driver.type("//*[@id='kw']", u"pyse自动化测试")
driver.click("//*[@id='su']")
sleep(2)
driver.quit()
Beispiel #38
0
 def setUpClass(cls):
     cls.driver = Pyse("chrome")
Beispiel #39
0
 def setup(self):
     self.driver = Pyse("chrome")
     self.base_url = "http://www.126.com"
Beispiel #40
0
# coding=utf-8
from pyse import Pyse, TestRunner
from nose.tools import with_setup
from time import sleep


def my_setup_function():
    print "test case start:"


def my_teardown_function():
    print "test case end."


@with_setup(my_setup_function, my_teardown_function)
def test01():
	''' testlogin '''
driver = Pyse("chrome")
driver.open("http://tb2c.qicolor.cn/#/login")
driver.type("xpath=>.//*[@id='login_box']/form/div[1]/input", u"15951819465")
driver.type("xpath=>.//*[@id='login_box']/form/div[2]/input", u"123456")
driver.type("xpath=>.//*[@id='login_box']/form/a", u"")
sleep(3)
driver.quit()



if __name__ == '__main__':
    TestRunner().run()
Beispiel #41
0
 def setUp(self):
     self.driver = Pyse("chrome")
     self.driver.wait(10)
     self.base_url = "http://www.baidu.com"
Beispiel #42
0
 def setUpClass(cls):
     """ Setting browser driver, Using chrome by default."""
     cls.driver = Pyse("chrome")
Beispiel #43
0
 def setUp(self):
     self.driver = Pyse("chrome")
     self.driver.wait(10)
     self.base_url = "http://www.baidu.com"
Beispiel #44
0
#coding=utf-8
from pyse import Pyse
from time import sleep

driver = Pyse("chrome")

driver.open("http://bbs.meizu.cn")
driver.type("//*[@name='srchtxt']",u"手机")
driver.open_new_window("//*[@name='searchsubmit']")
sleep(2)
print driver.get_title()
driver.quit()