-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeviceInfo.py
More file actions
26 lines (23 loc) · 924 Bytes
/
DeviceInfo.py
File metadata and controls
26 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import xml.etree.ElementTree as ET
from lxml import html
import requests
class DeviceInfo:
def __init__(self):
tree = ET.parse("Devices.xml")
self.root = tree.getroot()
def getDevice(self, udid):
deviceNode = self.root.findall(".//device[udid='" + udid + "']")
try:
device = {}
device['udid'] = deviceNode[0].find('udid').text
device['name'] = deviceNode[0].find('deviceName').text
device['manufacturer'] = deviceNode[0].find('manufacturer').text
device['model'] = deviceNode[0].find('model').text
device['osv'] = deviceNode[0].find('osv').text
except:
pass
return device
def gridDevices(self):
page = requests.get('http://10.238.242.218:4444/grid/console')
tree = html.fromstring(page.text)
return tree.xpath('//a[contains(@title, "ANDROID")]/text()')