Appium 写了一个遍历,但是变量 b 每次我加 1 的时候,都没有传进变量 x,请帮我看看语法哪里错了

wagnxinghao · 2017年04月28日 · 609 次阅读

coding=utf-8

import time
from appium import webdriver
from public.public import go_xy
from public.public import go_swipe
import sys
reload(sys)
sys.setdefaultencoding('utf8')
a = 1; b = 1; c = 1

def test_yuanDongZuo(self):
global i,b,f,a,c,x,y,z
'''先进入朋友空间,然后遍历所有元动作'''
self.driver.tap([(259.2, 714.2)], )
time.sleep(5)
go_xy(self,384.3,437.4)

for c in range(1,10):
# print (c)
x ='//UIAApplication[1]/UIAWindow[1]/UIATableView[3]/UIATableCell[' + str(c) + ']/UIAButton[' + str(b) + ']'
for b in range(1,10,1):
print(b)
self.driver.find_element_by_xpath(x).click()
print(x)
try:
for a in range (1,12,2):
self.driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[3]/UIATableCell[' + str(c) + ']/UIAStaticText[' + str(a) + ']').click()
except:
print (u'结束')

执行的结果是 try 中运行结束后挑出当前循环,b 自动加 1,但是没有加到变量 x 中,所以每次都还是进入相同位置,下面是 html 报告,哪位大侠帮忙看下:

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册