Appium commonly used functions are:Get page information:1. Def get_current_activity (CLS, driver): "Gets the Activity:param of the current page Driver::return:" ' Return Driver.current_activity2 , Def get_current_pagesource (CLS, driver): "Gets the current page source code: param Driver::return: The return data type is str" ' Return DRIVER.PAGE_SOURCE3, Def get_contexts (CLS, driver): "Gets all the context names of the current window: param driver::return: Returns the current all Windows context, can be toggled, switch_to_context () "Return driver.contexts more APIs to view Webdriver source codeGet element:Several common positioning methods have been introduced in appium positioning, and the special positioning methods in Appium are introduced: 1, find_element_by_accessibility_id,in Uiautomatorviewer, the Content-desc content is accessibility_id2, Find_elements_by_android_uiautomator, use the Uiautomator in Android to locate elements①text Propertydriver.find_element_by_android_uiautomator (' New Uiselector (). Text ("CustomView"). Click () #textdriver.find_element_by_android_uiautomator (' New Uiselector (). Textcontains ("View"). Click () #textContains driver.find_element_by_android_uiautomator (' New Uiselector (). Textstartswith ("Custom") '). Click () # Textstartswithdriver.find_element_by_android_uiautomator (' New Uiselector (). Textmatches ("^custom.*"). Click () #textMatches ②class Propertydriver.find_element_by_android_uiautomator (' Newuiselector (). ClassName ("Android.widget.TextView"). Text (" Custom View "). Click () #className③resourceid Propertydriver.find_element_by_android_uiautomator (' Newuiselector (). ResourceId ("Android:id/text1") '). Click () # ResourceIdmore methods based on actual searchControl actions:1. Enter Send_keys () 2, click on the button (): Click () 3, Slide driver.swipe (x1, y1, x2, y2), X1 Y1 as the starting position X2 Y2 for the end position swipe there is also a parameter is sliding time, duration4, zoom pinch () By default zoom in by half Zoom () by default magnification by 5, touch long_press () long Press () Short press release () releasing wait () wait cancel () cancel perform () The action to perform this event is the same as webdriver in selenium, with an action class that is Touchactionaction = touchaction (Driver) action.long_press () in Appium. Wait (+). Perform () The default unit is Ms 6, Android KeyEvent value keycode_unknown=0; Keycode_soft_left=1; keycode_soft_right=2; keycode_home=3; keycode_back=4; keycode_call=5; keycode_endcall=6; keycode_0=7; keycode_1=8; keycode_2=9; keycode_3=10; keycode_4=11; keycode_5=12; keycode_6=13; keycode_7=14; keycode_8=15; keycode_9=16; keycode_star=17; keycode_pound=18; keycode_dpad_up=19; keycode_dpad_down=20; keycode_dpad_left=21; keycode_dpad_right=22; keycode_dpad_center=23; keycode_volume_up=24; keycode_volume_down=25; keycode_power=26; keycode_camera=27; keycode_clear=28; keycode_a=29; keycode_b=30; keycode_c=31; keycode_d=32; keycode_e=33; keycode_f=34; keycode_g=35; keycode_h=36; keycode_i=37; keycode_j=38; keycode_k=39; KeyCode_l=40; keycode_m=41; keycode_n=42; keycode_o=43; keycode_p=44; keycode_q=45; keycode_r=46; keycode_s=47; keycode_t=48; keycode_u=49; keycode_v=50; keycode_w=51; keycode_x=52; keycode_y=53; keycode_z=54; keycode_comma=55; keycode_period=56; keycode_alt_left=57; keycode_alt_right=58; keycode_shift_left=59; keycode_shift_right=60; keycode_tab=61; keycode_space=62; keycode_sym=63; keycode_explorer=64; keycode_envelope=65; keycode_enter=66; keycode_del=67; keycode_grave=68; keycode_minus=69; keycode_equals=70; keycode_left_bracket=71; keycode_right_bracket=72; keycode_backslash=73; keycode_semicolon=74; keycode_apostrophe=75; keycode_slash=76; keycode_at=77; keycode_num=78; keycode_headsethook=79; keycode_focus=80;//*camera*focuskeycode_plus=81; keycode_menu=82; keycode_notification=83; keycode_search=84; keycode_media_play_pause=85; keycode_media_stop=86; keycode_media_next=87; keycode_media_previous=88; keycode_media_rewind=89; keycode_media_fast_forward=90; keycode_mute=91;Other Related: 1, reset () reset the app, such as the first login to the app's navigation page 2, is_app_installed () to determine whether the app is installed, return Boolean values such as: Use login to determine whether to install 3, Install_app ()
Note that one is the app name, while the installation app gives the app path 4, Remove_app () uninstall APP5, Close_app () off App6, wait_activity () Implicit wait for the activity time-out to wait Detection time interval three parameters 7, Get_screenshot_as_file () screenshot Save picture Path
Appium--api Common functions