|
PATH=lambda ps.path.abspath(os.path.join(os.path.dirname(__file__),p))
desired_caps={}
desired_caps['device'] = 'android'
desired_caps['platformName']='Android'
desired_caps['browserName']=''
desired_caps['Version']='4.4.4'
desired_caps['deviceName']=device
#desired_caps['app']=PATH('D:\\jr.apk')
desired_caps['appPackage'] = pack
desired_caps['appActivity'] = activity
driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
while 1:
if driver.current_activity=='.activity.MainActivity':
break
els=driver.find_elements_by_id('el')
news_t1=els[0].text
print 'news1_title:',news_t1
els=driver.find_elements_by_id('p_')
els[1].click()
while 1:
els=driver.find_elements_by_id('el')
news_t2=els[0].text
print 'news2_title:',news_t2
if news_t2!=news_t1:
break
老师,怎么这些都没解释下意思哦,device='4d0041b1be98b01f' #此处设备号
pack='com.ss.android.article.news' #此处是我们app的package名称
activity='com.ss.android.article.news.activity.SplashActivity'#此处是我们的app的主activity,这些都弄懂了下边你写的python脚本看不懂 |
|