예제 #1
0
파일: excel.py 프로젝트: flj1860/ranzhji
 def __init__(self, file):
     #一个软件只有一个工作路径,所以当有可能从不同的入口执行时,需要获取当前的绝对路径,再去查找相对路径
     self.file = Base.get_cur_dir(
         __file__) + "\\" + file  #永远是基于excel.py所在路径
     self.targetName = self.file.replace(
         ".xlsx", (time.strftime("%Y-%m-%d-%H-%M-%S") + ".xlsx"))
     self.data = None
예제 #2
0
def init_screenshot_dir():
    rootLogDir = Base.get_cur_dir(__file__)
    currentLogDirName = time.strftime('%Y-%m-%d-%H_%M_%S',
                                      time.localtime(time.time()))
    currentTimeStampLogDir = os.path.join(rootLogDir, currentLogDirName)
    os.mkdir(currentTimeStampLogDir)
    return currentTimeStampLogDir
예제 #3
0
 def open_driver(self):
     try:
         fp = webdriver.FirefoxProfile(
             Base.get_cur_dir(__file__) + "\\..\\firefoxPro")
         self.driver = webdriver.Firefox(fp)  #打开火狐
         self.driver.maximize_window()  #最大化窗口
         self.driver.implicitly_wait(10)  #隐式等待10秒
         return True
     except:
         Base.printErr("打开或设置浏览器失败!")
         return False
예제 #4
0
# -*- coding: utf-8 -*-
import uiautomator2 as u2
from function.utils import Util
from function.base.base import Base
import os, time
import xml.etree.ElementTree as ET

AGILEAPP = "com.gionee.agileapp"
__author__ = 'suse'
device = "IZEAMF6LLJVSLNQC"
rootLogDir = Base.get_cur_dir(__file__)
currentLogDirName = time.strftime('%Y-%m-%d-%H_%M_%S',
                                  time.localtime(time.time()))
currentTimeStampLogDir = os.path.join(rootLogDir, currentLogDirName)
os.mkdir(currentTimeStampLogDir)
d = u2.connect_usb(device)
d.app_start(AGILEAPP)
d(scrollable=True).scroll.to(text="看了吗")
d(text="看了吗").sibling(resourceId="com.gionee.agileapp:id/launch").click()
d(packageName="com.gionee.agileapp", className="android.view.View").wait()
xml = d.dump_hierarchy()
# print(xml)
root = ET.fromstring(xml)
print(xml)
# nodes = root.findall(".//*[@package='com.gionee.agileapp']/node")
for node in root.findall(".//*[@package='com.gionee.agileapp']/node"):
    className = node.get("class")
    # childNode = node.find("..//*[@class='android.view.View']/node")
    if (className == "android.view.View"):
        d.app_start(AGILEAPP)
        d(scrollable=True).scroll.to(text="看了吗")