• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Appium 自動化測試演示(2)

    發表于:2013-11-20來源:TesterHome作者:guo點擊數: 標簽:Appium
    except: logging.info(沒上傳提示) click(wd.find_element_by_xpath(//window[1]/tableview[1]/cell[1]/text[1])) click(wd.find_element_by_xpath(//window[1]/tableview[1]/cell[1])) execute_script(mobile:

      except:

      logging.info('沒上傳提示')

      click(wd.find_element_by_xpath("//window[1]/tableview[1]/cell[1]/text[1]"))

      click(wd.find_element_by_xpath("//window[1]/tableview[1]/cell[1]"))

      execute_script("mobile: swipe",

      {"touchCount": 1, "startX": 157, "startY": 529, "endX": 156, "endY": 102, "duration": 0.5})

      click(wd.find_element_by_name(" 返回"))

      click(wd.find_element_by_name(" 返回"))

      click(wd.find_element_by_xpath("//window[1]/button[1]"))

      except:

      traceback.print_exc()

      success = False

      finally:

      if success:

      #raise Exception("Test failed.")

      compare()

      wd.quit()

      計算圖片相似度部分

      # -*- coding: utf-8 -*-

      import Image

      def make_regalur_image(img, size=(256, 256)):

      return img.resize(size).convert('RGB')

      def split_image(img, part_size=(64, 64)):

      w, h = img.size

      pw, ph = part_size

      assert w % pw == h % ph == 0

      return [img.crop((i, j, i + pw, j + ph)).copy() \

      for i in xrange(0, w, pw) \

      for j in xrange(0, h, ph)]

      def hist_similar(lh, rh):

      assert len(lh) == len(rh)

      return sum(1 - (0 if l == r else float(abs(l - r)) / max(l, r)) for l, r in zip(lh, rh)) / len(lh)

      def calc_similar(li, ri):

      # return hist_similar(li.histogram(), ri.histogram())

      return sum(hist_similar(l.histogram(), r.histogram()) for l, r in zip(split_image(li), split_image(ri))) / 16.0

      def calc_similar_by_path(lf, rf):

      li, ri = make_regalur_image(Image.open(lf)), make_regalur_image(Image.open(rf))

      return calc_similar(li, ri)

      def make_doc_data(lf, rf):

      li, ri = make_regalur_image(Image.open(lf)), make_regalur_image(Image.open(rf))

      li.save(lf + '_regalur.png')

      ri.save(rf + '_regalur.png')

      fd = open('stat.csv', 'w')

      fd.write('\n'.join(l + ',' + r for l, r in zip(map(str, li.histogram()), map(str, ri.histogram()))))

      # print >>fd, '\n'

      # fd.write(','.join(map(str, ri.histogram())))

      fd.close()

      import ImageDraw

      li = li.convert('RGB')

      draw = ImageDraw.Draw(li)

      for i in xrange(0, 256, 64):

      draw.line((0, i, 256, i), fill='#ff0000')

      draw.line((i, 0, i, 256), fill='#ff0000')

      li.save(lf + '_lines.png')

    原文轉自:http://testerhome.com/topics/201

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>