此贴用于 TesterHome 重庆 Workshop
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install -g appium
任何一个即可
adb devices
adb install -r ~/Downloads/xueqiu_wxdialog.apk
adb logcat -s ActivityManager:I
06-02 15:01:20.704 551 569 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.xueqiu.android/.view.WelcomeActivityAlias bnds=[43,131][170,328]} from uid 10031 on display 0
06-02 15:01:20.756 551 735 I ActivityManager: Start proc 1911:com.xueqiu.android/u0a35 for activity com.xueqiu.android/.view.WelcomeActivityAlias
06-02 15:01:21.785 551 1793 I ActivityManager: Start proc 1971:com.xueqiu.android:pushservice/u0a35 for service com.xueqiu.android/com.xiaomi.push.service.XMPushService
06-02 15:01:22.083 551 595 I ActivityManager: Displayed com.xueqiu.android/.view.WelcomeActivityAlias: +1s346ms
06-02 15:01:26.181 551 569 I ActivityManager: START u0 {flg=0x100000 pkg=com.xueqiu.android cmp=com.xueqiu.android/.common.MainActivity} from uid 10035 on display 0
06-02 15:01:27.259 551 595 I ActivityManager: Displayed com.xueqiu.android/.common.MainActivity: +1s48ms
TODO 2:00-3:00
{
"platformName": "android",
"deviceName": "chongqing",
"appPackage": "com.xueqiu.android",
"appActivity": ".view.WelcomeActivityAlias"
}
解决权限弹框
{
"platformName": "android",
"deviceName": "chongqing",
"appPackage": "com.xueqiu.android",
"appActivity": ".view.WelcomeActivityAlias",
"autoGrantPermissions": "true"
}
常见问题
# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python
from appium import webdriver
caps = {}
caps["platformName"] = "android"
caps["deviceName"] = "chongqing"
caps["appPackage"] = "com.xueqiu.android"
caps["appActivity"] = ".view.WelcomeActivityAlias"
caps["autoGrantPermissions"] = "true"
driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
#人工追加保证稳定西行
driver.implicitly_wait(10)
el1 = driver.find_element_by_id("com.xueqiu.android:id/user_profile_icon")
el1.click()
el2 = driver.find_element_by_id("com.xueqiu.android:id/tv_login")
el2.click()
el3 = driver.find_element_by_id("com.xueqiu.android:id/tv_login_by_phone_or_others")
el3.click()
el4 = driver.find_element_by_id("com.xueqiu.android:id/register_phone_number")
el4.send_keys("15600534760")
el5 = driver.find_element_by_id("com.xueqiu.android:id/register_code")
el5.send_keys("123456")
el6 = driver.find_element_by_id("com.xueqiu.android:id/button_next")
el6.click()
driver.quit()
/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.support.v4.view.ViewPager/android.widget.RelativeLayout/android.widget.ListView/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.TextView
//*[@text='BABA']
(//*[@resource-id='com.xueqiu.android:id/stockCode'])[1]
//*[@text='01810']/../../..//*[@resource-id='com.xueqiu.android:id/followed_btn']
//*[@text='01810']/../../..//*[contains(@resource-id, '_btn')]
def test_po(self):
main_page=MainPage(self.driver)
search_page=main_page.gotoSearch()
search_page.search("xiaomi")
def test_po(self):
main_page=MainPage(self.driver)
search_page=main_page.gotoSearch()
search_page.search("alibaba")
def test_tsl(self):
MainPage(self.driver).gotoSearch().search("tesla")
git clone https://github.com/zhangzhao4444/Maxim
cd Maxim
adb push framework.jar /sdcard
adb push monkey.jar /sdcard
adb shell CLASSPATH=/sdcard/monkey.jar:/sdcard/framework.jar exec app_process /system/bin tv.panda.test.monkey.Monkey -p com.xueqiu.anroid --uiautomatormix --running-minutes 60 -v -v
java -jar appcrawler-2.4.0-jar-with-dependencies.jar --capability "appPackage=com.xueqiu.android,appActivity=.view.WelcomeActivityAlias"