Created
March 11, 2019 15:49
-
-
Save MildaGenius/a9eaf629880ff83b3410897d0b5b4e7b to your computer and use it in GitHub Desktop.
Test script for pull file from iOS device over Appium.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
from time import sleep | |
from appium import webdriver | |
from altunityrunner import AltrunUnityDriver | |
PATH = lambda p: os.path.abspath( | |
os.path.join(os.path.dirname(__file__), p) | |
) | |
verbose = True | |
class SampleAppiumTest(): | |
desired_caps = {} | |
appiumdriver = None | |
def initialize(self, platform): | |
#according to platform do setup | |
if platform == 'ios': | |
self.setUpIos() | |
elif platform == 'android': | |
self.setUpAndroid() | |
@classmethod | |
def setUpIos(self): | |
self.desired_caps['showIOSLog'] = True | |
self.desired_caps['platformName'] = 'iOS' | |
self.desired_caps['platformVersion'] = '11.3' | |
self.desired_caps['xcodeOrgId'] = '7DC7W55G5S' | |
self.desired_caps['automationName'] = 'xcuitest' | |
self.desired_caps['xcodeSigningId'] = 'iPhone Developer' | |
self.desired_caps['bundleId'] = 'com.bistudio.AppiumTest' | |
self.desired_caps['deviceName'] = 'BIMG_Milan_Malek_iPad9.7' | |
#self.desired_caps['app'] = '/Users/mmalek/Appium/DebuggerTest/DebuggerTest.ipa' | |
self.desired_caps['updatedWDABundleId'] = 'com.bistudio.wda' | |
self.desired_caps['udid'] = '72b5479ee14fba814b3aaee20b1bfe9cea8bc2de' | |
# connect to appium server | |
self.appiumdriver = webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps) | |
@classmethod | |
def setUpAndroid(self): | |
self.desired_caps['deviceName'] = 'device' | |
self.desired_caps['platformName'] = 'android' | |
self.desired_caps['automationName'] = 'UiAutomator' | |
self.desired_caps['appPackage'] = 'com.bistudio.AppiumTest' | |
self.desired_caps['app'] = '/Users/mmalek/tests/AppiumTest/Builds/Android/AppiumTest.apk' | |
# connect to appium server | |
self.appiumdriver = webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps) | |
def pullFile(self): | |
#data = self.appiumdriver.pull_file("testFile.txt") | |
#data = self.appiumdriver.pull_file("Documents/testFile.txt") | |
data = self.appiumdriver.pull_file("com.bistudio.AppiumTest/testFile.txt") | |
fh = open("iosFile.txt", "wb") | |
fh.write(data.decode('base64')) | |
fh.close() | |
if __name__ == '__main__': | |
appiumTest = SampleAppiumTest() | |
appiumTest.initialize('ios') | |
appiumTest.pullFile() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment