Ejemplo n.º 1
0
    def test_script(self):
        self.h5Driver = WxDriver()
        self.h5Driver.wait(1)
        self.h5Driver.d(text="发现").click()
        self.h5Driver.wait(1)
        self.h5Driver.d(text="搜一搜").click()
        self.h5Driver.wait(2)
        self.h5Driver.d(text="搜索").clear_text()
        self.h5Driver.wait(1)
        self.h5Driver.d(text="搜索").set_text(u"腾讯医")
        self.h5Driver.wait(10)
        self.h5Driver.initDriver()
        self.h5Driver.wait(3)
        self.h5Driver.d(text="腾讯医典").click()
        self.h5Driver.wait(1)
        # 切换到小程序栏
        self.h5Driver.d(text="小程序").click()
        self.h5Driver.wait(1)
        self.h5Driver.d(textContains="腾讯医典").click()

        self.h5Driver.wait(3)

        self.h5Driver.getMemoryInfo()
Ejemplo n.º 2
0
# coding=utf-8
'''
Tencent is pleased to support the open source community by making FAutoTest available.
Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://opensource.org/licenses/BSD-3-Clause
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

'''
from fastAutoTest.core.wx.wxEngine import WxDriver
import os

# 进入企鹅医典小程序
if __name__ == '__main__':
    wxDriver = WxDriver()
    wxDriver.initDriver()
    # 点击全部疾病
    wxDriver.clickElementByXpath('/html/body/div/div[1]/div[2]/div[1]/a')
    wxDriver.clickFirstElementByText('肺癌')
    wxDriver.returnLastPage()
    wxDriver.returnLastPage()
    # 截图
    dirPath = os.path.split(os.path.realpath(__file__))[0]
    PIC_SRC = os.path.join(dirPath, 'pic.png')
    wxDriver.d.screenshot(PIC_SRC)
    wxDriver.close()
Ejemplo n.º 3
0
class SeFAutoTest(unittest.TestCase):
    def setUp(self):
        # 关闭微信
        os.system("adb shell am force-stop com.tencent.mm")
        # 启动微信
        os.system("adb shell am start com.tencent.mm/.ui.LauncherUI")
        time.sleep(5)

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

    def test_script(self):
        self.h5Driver = WxDriver()
        self.h5Driver.wait(1)
        self.h5Driver.d(text="发现").click()
        self.h5Driver.wait(1)
        self.h5Driver.d(text="搜一搜").click()
        self.h5Driver.wait(2)
        self.h5Driver.d(text="搜索").clear_text()
        self.h5Driver.wait(1)
        self.h5Driver.d(text="搜索").set_text(u"腾讯医")
        self.h5Driver.wait(10)
        self.h5Driver.initDriver()
        self.h5Driver.wait(3)
        self.h5Driver.d(text="腾讯医典").click()
        self.h5Driver.wait(1)
        # 切换到小程序栏
        self.h5Driver.d(text="小程序").click()
        self.h5Driver.wait(1)
        self.h5Driver.d(textContains="腾讯医典").click()

        self.h5Driver.wait(3)

        self.h5Driver.getMemoryInfo()
Ejemplo n.º 4
0
def testScript():
    print "start test..."
    # device = 'bdefdc13'
    h5Driver = WxDriver()
    h5Driver.wait(1)
    h5Driver.d(text="发现").click()
    h5Driver.wait(1)
    h5Driver.d(text="搜一搜").click()
    h5Driver.wait(2)
    h5Driver.d(text="搜索").clear_text()
    h5Driver.wait(1)
    h5Driver.d(text="搜索").set_text("腾讯医")
    h5Driver.wait(5)
    h5Driver.d(text="腾讯医典").click()
    h5Driver.wait(1)
    h5Driver.d(text="小程序").click()
    h5Driver.wait(1)
    h5Driver.d(textContains="腾讯医典").click()
    # 按键盘的搜索textContains
    # h5Driver.d.click()

    h5Driver.wait(1)
Ejemplo n.º 5
0
import time


def openWechat():
    # 关闭微信
    os.system("adb shell am force-stop com.tencent.mm")
    # 启动微信
    os.system("adb shell am start com.tencent.mm/.ui.LauncherUI")
    time.sleep(5)


# 进入企鹅医典小程序
if __name__ == '__main__':
    # openWechat()
    print "start test..."
    wxDriver = WxDriver()
    wxDriver.wait(1)
    # wxDriver.d(text="发现").click()
    # wxDriver.wait(1)
    # wxDriver.d(text="搜一搜").click()
    # wxDriver.wait(2)
    # wxDriver.d(text="搜索").clear_text()
    # wxDriver.wait(1)
    # wxDriver.d(text="搜索").set_text("腾讯医")
    # wxDriver.wait(5)
    # wxDriver.d(text="腾讯医典").click()
    # wxDriver.wait(1)
    # wxDriver.d(text="小程序").click()
    # wxDriver.wait(1)
    # wxDriver.d(textContains="腾讯医典").click()
    # wxDriver.wait(5)
Ejemplo n.º 6
0
def xcxOperator():
    print "start test..."
    wxDriver = WxDriver()
    wxDriver.d(text="发现").click()
    wxDriver.wait(1)
    wxDriver.d(text="搜一搜").click()
    wxDriver.wait(1)
    wxDriver.d(text="搜索").clear_text()
    wxDriver.d(text="搜索").set_text("卡亭")
    wxDriver.wait(2)
    wxDriver.d(text="卡亭小程序").click()
    wxDriver.wait(3)
    wxDriver.d(textContains="卡亭小程序 - 小程序").click()



    wxDriver.initDriver()
    txt = wxDriver.getElementTextByXpath("/html/body/div[1]/div/div[3]/p")
    print txt
    # 点击全部疾病
    wxDriver.clickElementByXpath('/html/body/div[1]/div/div[3]/p')
    wxDriver.clickFirstElementByText('白内障')
    wxDriver.returnLastPage()
    wxDriver.returnLastPage()
    # 截图
    # dirPath = os.path.split(os.path.realpath(__file__))[0]
    # PIC_SRC = os.path.join(dirPath, 'pic.png')
    # wxDriver.d.screenshot(PIC_SRC)
    # time.sleep(3)
    wxDriver.close()