你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> 2. UITest相關APIs

2. UITest相關APIs

編輯:IOS開發綜合

這篇文章為您講述2. UITest相關APIs的闡明,詳細操作請看面的內容

1. XCUIApplication

這是你正在測試的使用的代理。它能讓你啟動使用,這樣你就能執行測試了。它每次都會新起一個進程,這會多花一些時間,但是能保證測試使用時的形態是潔淨的,這樣你需求處置的變量就少了些。

- (void)launch;//啟動使用。假如目的使用已運轉,首先終止使用,然後再次啟動使用。
- (void)terminate;//封閉使用。
@property (nonatomic, copy) NSArray <NSString *> *launchArguments;//數組對象,保管啟動參數。
@property (nonatomic, copy) NSDictionary <NSString *, NSString *> *launchEnvironment;//字典對象,保管啟動環境變量
2. XCUIElement

這是你正在測試的使用中UI元素的代理。每個元素都有類型和標識符,結合二者就能找到使用中的UI元素。一切的元素都會嵌套在代表你的使用的樹中。

@property (readonly) BOOL exists; 這個控件能否存在(不論被遮擋或許不在以後屏幕內都是YES)

@property (readonly, getter = isHittable) BOOL hittable; 這個控件能否能找到一個點可以點擊

- (XCUIElementQuery *)descendantsMatchingType \:(XCUIElementType)type; 在這個元素裡依照固定的類型尋覓其一切的子元素,如: 在Table的Cell裡尋覓一切的子Button

locButton = [cell descendantsMatchingType:XCUIElementTypeButton];

2. UITest相關APIs

- (XCUICoordinate *)coordinateWithNormalizedOffset \:(CGVector)normalizedOffset;

在這個控件裡依據CGVector的比例前往一個點。

XCUICoordinate *bot = [Window coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.5)];//在Window中X比例為0.5,Y比例為0.5的一個點

2. UITest相關APIs/*! The Accessibility identifier. */ @property (readonly) NSString *identifier; /*! The frame of the element in the screen coordinate space. */ @property (readonly) CGRect frame; /*! The raw value attribute of the element. Depending on the element, the actual type can vary. */ @property (readonly, nullable) id value; /*! The title attribute of the element. */ @property (readonly, copy) NSString *title; /*! The label attribute of the element. */ @property (readonly, copy) NSString *label; /*! The type of the element. /seealso XCUIElementType. */ @property (readonly) XCUIElementType elementType; /*! Whether or not the element is enabled for user interaction. */ @property (readonly, getter = isEnabled) BOOL enabled; /*! The horizontal size class of the element. */ @property (readonly) XCUIUserInterfaceSizeClass horizontalSizeClass; /*! The vertical size class of the element. */ @property (readonly) XCUIUserInterfaceSizeClass verticalSizeClass; /*! The value that is displayed when the element has no value. */ @property (readonly, nullable) NSString *placeholderValue; /*! Whether or not the element is selected. */ @property (readonly, getter = isSelected) BOOL selected; #if TARGET_OS_TV /*! Whether or not the elment has UI focus. */ @property (readonly) BOOL hasFocus; 4. XCUIElementTypeQueryProvider協議

@property (readonly, copy) XCUIElementQuery *touchBars;
@property (readonly, copy) XCUIElementQuery *groups;
@property (readonly, copy) XCUIElementQuery *Windows;
@property (readonly, copy) XCUIElementQuery *sheets;
@property (readonly, copy) XCUIElementQuery *drawers;
@property (readonly, copy) XCUIElementQuery *alerts;
@property (readonly, copy) XCUIElementQuery *dialogs;
@property (readonly, copy) XCUIElementQuery *buttons;
@property (readonly, copy) XCUIElementQuery *radioButtons;
@property (readonly, copy) XCUIElementQuery *radioGroups;
@property (readonly, copy) XCUIElementQuery *checkBoxes;
@property (readonly, copy) XCUIElementQuery *disclosureTriangles;
@property (readonly, copy) XCUIElementQuery *popUpButtons;
@property (readonly, copy) XCUIElementQuery *comboBoxes;
@property (readonly, copy) XCUIElementQuery *menuButtons;
@property (readonly, copy) XCUIElementQuery *toolbarButtons;
@property (readonly, copy) XCUIElementQuery *popovers;
@property (readonly, copy) XCUIElementQuery *keyboards;
@property (readonly, copy) XCUIElementQuery *keys;
@property (readonly, copy) XCUIElementQuery *navigationBars;
@property (readonly, copy) XCUIElementQuery *tabBars;
@property (readonly, copy) XCUIElementQuery *tabGroups;
@property (readonly, copy) XCUIElementQuery *toolbars;
@property (readonly, copy) XCUIElementQuery *statusBars;
@property (readonly, copy) XCUIElementQuery *tables;
@property (readonly, copy) XCUIElementQuery *tableRows;
@property (readonly, copy) XCUIElementQuery *tableColumns;
@property (readonly, copy) XCUIElementQuery *outlines;
@property (readonly, copy) XCUIElementQuery *outlineRows;
@property (readonly, copy) XCUIElementQuery *browsers;
@property (readonly, copy) XCUIElementQuery *collectionViews;
@property (readonly, copy) XCUIElementQuery *sliders;
@property (readonly, copy) XCUIElementQuery *pageIndicators;
@property (readonly, copy) XCUIElementQuery *progressIndicators;
@property (readonly, copy) XCUIElementQuery *activityIndicators;
@property (readonly, copy) XCUIElementQuery *segmentedControls;
@property (readonly, copy) XCUIElementQuery *pickers;
@property (readonly, copy) XCUIElementQuery *pickerWheels;
@property (readonly, copy) XCUIElementQuery *switches;
@property (readonly, copy) XCUIElementQuery *toggles;
@property (readonly, copy) XCUIElementQuery *links;
@property (readonly, copy) XCUIElementQuery *images;
@property (readonly, copy) XCUIElementQuery *icons;
@property (readonly, copy) XCUIElementQuery *searchFields;
@property (readonly, copy) XCUIElementQuery *scrollViews;
@property (readonly, copy) XCUIElementQuery *scrollBars;
@property (readonly, copy) XCUIElementQuery *staticTexts;
@property (readonly, copy) XCUIElementQuery *textFields;
@property (readonly, copy) XCUIElementQuery *secureTextFields;
@property (readonly, copy) XCUIElementQuery *datePickers;
@property (readonly, copy) XCUIElementQuery *textViews;
@property (readonly, copy) XCUIElementQuery *menus;
@property (readonly, copy) XCUIElementQuery *menuItems;
@property (readonly, copy) XCUIElementQuery *menuBars;
@property (readonly, copy) XCUIElementQuery *menuBarItems;
@property (readonly, copy) XCUIElementQuery *maps;
@property (readonly, copy) XCUIElementQuery *webViews;
@property (readonly, copy) XCUIElementQuery *steppers;
@property (readonly, copy) XCUIElementQuery *incrementArrows;
@property (readonly, copy) XCUIElementQuery *decrementArrows;
@property (readonly, copy) XCUIElementQuery *tabs;
@property (readonly, copy) XCUIElementQuery *timelines;
@property (readonly, copy) XCUIElementQuery *ratingIndicators;
@property (readonly, copy) XCUIElementQuery *valueIndicators;
@property (readonly, copy) XCUIElementQuery *splitGroups;
@property (readonly, copy) XCUIElementQuery *splitters;
@property (readonly, copy) XCUIElementQuery *relevanceIndicators;
@property (readonly, copy) XCUIElementQuery *colorWells;
@property (readonly, copy) XCUIElementQuery *helpTags;
@property (readonly, copy) XCUIElementQuery *mattes;
@property (readonly, copy) XCUIElementQuery *dockItems;
@property (readonly, copy) XCUIElementQuery *rulers;
@property (readonly, copy) XCUIElementQuery *rulerMarkers;
@property (readonly, copy) XCUIElementQuery *grids;
@property (readonly, copy) XCUIElementQuery *levelIndicators;
@property (readonly, copy) XCUIElementQuery *cells;
@property (readonly, copy) XCUIElementQuery *layoutAreas;
@property (readonly, copy) XCUIElementQuery *layoutItems;
@property (readonly, copy) XCUIElementQuery *handles;
@property (readonly, copy) XCUIElementQuery *otherElements;

經過本文的學習希望對您理解和學習IOS開發的相關知識有一些好的協助.感激關注本站.我們將為您搜集更多更好的IOS開發教程.

【2. UITest相關APIs】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved