How to use set_ios_version method in robotframework-ioslibrary

Best Python code snippet using robotframework-ioslibrary_python

__init__.py

Source:__init__.py Github

copy

Full Screen

...88 """89 allowed = ("iPhone", "iPad", "iPhone (Retina)", "iPad (Retina)")90 assert device_name in allowed, "%s is not in %r, but should be." % (device_name, allowed)91 self._device = device_name92 def set_ios_version(self, ios_major_version=5):93 """94 Set the iOS Version used for sending the correct gestures.95 `ios_version` The iOS version of the device that is connceted. Valid96 values are: 4, 5, 6, must be a number.97 """98 assert type(ios_version) is int, "%s is not a number, but should be." % (device_name, allowed)99 self._ios_major_version = ios_major_version100 def _get_app_and_binary(self, app_path):101 filename, ext = os.path.splitext(app_path)102 binary = None103 if ext == '.app':104 binary = os.path.join(app_path, filename)105 elif ext == '':106 app_path = os.path.dirname(app_path)...

Full Screen

Full Screen

scrapkeys.py

Source:scrapkeys.py Github

copy

Full Screen

1#!/usr/bin/python32import sys3import os4import json5from urllib.request import urlopen6import mechanicalsoup7class colors :8 GREEN = '\033[92m'9 ENDG = '\033[0m'10def parse_iphonewiki(url2parse, img_type):11 br = mechanicalsoup.StatefulBrowser()12 html = br.open(url2parse)13 keypage = list()14 keypage = ["rootfs-key", "updateramdisk-iv", "updateramdisk-key",15 "restoreramdisk-iv", "restoreramdisk-key", "applelogo-iv",16 "applelogo-key", "batterycharging0-iv", "batterycharging0-key",17 "batterycharging1-iv", "batterycharging1-key", "batteryfull-iv",18 "batteryfull-key", "batterylow0-iv", "batterylow0-key",19 "batterylow1-iv", "batterylow1-key", "devicetree-iv",20 "devicetree-key", "glyphcharging-iv", "glyphcharging-key",21 "glyphplugin-iv", "glyphplugin-key",22 "ibec-iv", "ibec-key", "iboot-iv", "iboot-key",23 "ibss-iv", "ibss-key", "kernelcache-iv",24 "kernelcache-key", "llb-iv", "llb-key",25 "recoverymode-iv", "recoverymode-key",26 "sepfirmware-iv", "sepfirmware-key"]27 j = 028 key = ""29 for i in range(0, len(keypage)):30 for hit in br.get_current_page().find_all(attrs={'id': "keypage-" + keypage[i]}):31 if img_type == None:32 bl = keypage[i]33 print(bl + ":\n\t %s" % hit.text)34 elif img_type != None and img_type == keypage[i].split('-')[0]:35 j += 136 key += hit.text37 if j == 2:38 return key39# Used to 'convert' version -> build ID and vice versa40# I just parse firmwares.json on api.ipsw.me41def version_or_build(model, version, build):42 get_buildid = False43 get_version = False44 json_file = urlopen("https://api.ipsw.me/v4/device/" + model)45 with open(model, 'wb') as output:46 output.write(json_file.read())47 data = json.load(open(model))48 if build is None:49 get_buildid = True50 elif version is None:51 get_version = True52 i = 053 with open(model):54 while True:55 if get_buildid is True:56 result = data["firmwares"][i]["buildid"]57 ios_version = data["firmwares"][i]["version"]58 if ios_version == version:59 break60 elif get_version is True:61 buildid = data["firmwares"][i]["buildid"]62 result= data["firmwares"][i]["version"]63 if build == buildid:64 break65 i += 166 os.remove(model)67 return result68# we need to get the codename of the firmware to access the URL69def get_codename(device, version, build):70 version = version.split('.')[0] + ".x"71 url = "https://www.theiphonewiki.com/wiki/Firmware_Keys/" + version72 br = mechanicalsoup.StatefulBrowser()73 html = br.open(url) #.read()74 i = 075 checker = False76 data = br.get_current_page().find_all('a')77 device = "(%s)" % device78 for hit in data:79 # some beta may have the same codename, first in first out80 if checker is False:81 try:82 if data[i].get('href').split('_')[1] == build and data[i].get('href').split('_')[2] == device:83 checker = True84 codename = data[i].get('href').split('/')[2].split('_')[0]85 return codename86 except:87 pass88 i += 189def usage(toolname):90 print("usage: " + toolname + " [args]")91 print(" -d <device>")92 print(" -i <version>")93 print(" -b <build ID>")94 print(" -c <codename>")95if __name__ == '__main__':96 argc = len(sys.argv)97 argv = sys.argv98 check = 099 codename = None100 ios_v = None101 build = None102 set_ios_version = None103 if argc <= 4:104 usage(argv[0])105 sys.exit(-1)106 for i in range(0,argc):107 if argv[i] == "-i":108 ios_v = argv[i + 1]109 set_ios_version = True110 elif argv[i] == "-b" :111 build = argv[i + 1]112 elif argv[i] == "-d" :113 device = argv[i + 1]114 elif argv[i] == "-c":115 codename = argv[i + 1]116 if set_ios_version is True:117 build = version_or_build(device, ios_v, build)118 else:119 ios_v = version_or_build(device, ios_v, build)120 if codename is None:121 codename = get_codename(device, ios_v, build)122 print("[+] build ID : " + build)123 if codename is None:124 codename = get_codename(device, ios_v, build)125 url = "https://www.theiphonewiki.com/wiki/" + codename + "_" + build + "_" + "(" + device + ")"126 print("[+] grabbing keys from " + url)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run robotframework-ioslibrary automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful