mirror of
https://github.com/appium/appium.git
synced 2026-02-13 21:39:49 -06:00
Adding Objective C samples
This commit is contained in:
@@ -56,6 +56,11 @@ $this->lock(3);
|
||||
driver.LockDevice(3);
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver lockDeviceScreen:3];
|
||||
```
|
||||
|
||||
### Background app
|
||||
|
||||
Send the currently active app to the background.
|
||||
@@ -90,6 +95,11 @@ $this->backgroundApp(5);
|
||||
driver.BackgroundApp(5);
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver runAppInBackground:3];
|
||||
```
|
||||
|
||||
### Hide Keyboard
|
||||
|
||||
Hide the keyboard.
|
||||
@@ -125,6 +135,11 @@ $this->hideKeyboard(array('strategy' => 'pressKey', 'key' => 'Done'));
|
||||
driver.HideKeyboard("Done");
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver hideKeyboard];
|
||||
```
|
||||
|
||||
### Start Activity
|
||||
|
||||
Open an activity in the current app or start a new app and open an activity *Android only*
|
||||
@@ -160,6 +175,10 @@ $this->startActivity(array("appPackage" => "com.example.android.apis",
|
||||
"appActivity" => ".Foo"));
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver startActivity:@"com.example.android.apis" package:@".Foo"];
|
||||
```
|
||||
|
||||
### Open Notifications
|
||||
|
||||
@@ -195,6 +214,11 @@ driver.OpenNotifications();
|
||||
$this->openNotifications();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver openNotifications];
|
||||
```
|
||||
|
||||
### Is installed
|
||||
|
||||
Check if an app is installed
|
||||
@@ -230,6 +254,11 @@ $this->isAppInstalled('com.example.android.apis');
|
||||
driver.IsAppInstalled("com.example.android.apis-");
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver isAppInstalled:@"com.example.android.apis-"];
|
||||
```
|
||||
|
||||
### Install App
|
||||
|
||||
Install an app to the device.
|
||||
@@ -264,6 +293,11 @@ $this->installApp('path/to/my.apk');
|
||||
driver.InstallApp("path/to/my.apk");
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver installAppAtPath:@"path/to/my.apk"];
|
||||
```
|
||||
|
||||
### Remove App
|
||||
|
||||
Remove an app from the device.
|
||||
@@ -298,6 +332,11 @@ $this->removeApp('com.example.android.apis');
|
||||
driver.RemoveApp("com.example.android.apis");
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver removeApp:@"com.example.android.apis"];
|
||||
```
|
||||
|
||||
### Shake
|
||||
|
||||
Simulate the device shaking.
|
||||
@@ -332,6 +371,11 @@ $this->shake();
|
||||
driver.ShakeDevice();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver shakeDevice];
|
||||
```
|
||||
|
||||
### Close app
|
||||
|
||||
Close the app
|
||||
@@ -366,6 +410,11 @@ $this->closeApp();
|
||||
driver.CloseApp();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver closeApp];
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
Launch the app
|
||||
@@ -400,6 +449,11 @@ $this->launchApp();
|
||||
driver.LaunchApp();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver launchApp];
|
||||
```
|
||||
|
||||
### Reset
|
||||
|
||||
Reset the app.
|
||||
@@ -434,6 +488,11 @@ $this->reset();
|
||||
driver.ResetApp();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver resetApp];
|
||||
```
|
||||
|
||||
### Available Contexts
|
||||
|
||||
List all available contexts
|
||||
@@ -468,6 +527,11 @@ $this->contexts();
|
||||
driver.GetContexts()
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
NSArray *contexts = driver.allContexts;
|
||||
```
|
||||
|
||||
### Current context
|
||||
|
||||
List the current context
|
||||
@@ -503,6 +567,11 @@ $this->context();
|
||||
driver.GetContext()
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
NSString *context = driver.context;
|
||||
```
|
||||
|
||||
### Switch to default context
|
||||
|
||||
Change the context to the default.
|
||||
@@ -537,6 +606,11 @@ $this->context(NULL);
|
||||
driver.SetContext();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver setContext:nil];
|
||||
```
|
||||
|
||||
### App Strings
|
||||
|
||||
Get the app's strings.
|
||||
@@ -572,6 +646,12 @@ $this->appStrings('ru');
|
||||
driver.GetAppStrings();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
[driver appStrings];
|
||||
[driver appStringsForLanguage:"@ru"];
|
||||
```
|
||||
|
||||
### Key Event
|
||||
|
||||
Send a key event to the device.
|
||||
@@ -606,6 +686,12 @@ $this->keyEvent('176');
|
||||
driver.KeyEvent("176");
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
NSError *err;
|
||||
[driver triggerKeyEvent:176 metastate:0 error:&err];
|
||||
```
|
||||
|
||||
### Current Activity
|
||||
|
||||
Android only. Get the current activity.
|
||||
@@ -640,6 +726,12 @@ $this->currentActivity();
|
||||
driver.GetCurrentActivity();
|
||||
```
|
||||
|
||||
```objectivec
|
||||
// objective c
|
||||
NSError *err;
|
||||
[driver currentActivity];
|
||||
```
|
||||
|
||||
### TouchAction / MultiTouchAction
|
||||
|
||||
An API for generating touch actions. This section of the documentation will be
|
||||
|
||||
Reference in New Issue
Block a user