Skip to content

Commit

Permalink
Add appium driver, part 1
Browse files Browse the repository at this point in the history
Signed-off-by: xcgspring <[email protected]>
  • Loading branch information
xcgspring committed Apr 17, 2015
1 parent c2ef9ab commit 1da9a33
Show file tree
Hide file tree
Showing 3 changed files with 446 additions and 0 deletions.
35 changes: 35 additions & 0 deletions AXUI/driver/appium_driver/Translater.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'''
translate AXUI identifier to webdriver search condition
'''
from AXUI.logger import LOGGER
from AXUI.driver import DriverException

from appium.webdriver.common.mobileby import MobileBy

class ID_Translater(object):
'''
translate parsed identifier to accordingly selenium find identifier
'''
def __init__(self, parsed_identifier):
self.parsed_identifier = parsed_identifier

def get_translated(self):
'''
get translated result from parsed identifier
'''
if len(self.parsed_identifier) == 2:
name = self.parsed_identifier[0]
value = self.parsed_identifier[1]
try:
getattr(MobileBy, name.upper())
except AttributeError:
LOGGER().error("identifier not support: %s" , name)
raise DriverException("identifier not support: %s" % name)
return getattr(MobileBy, name.upper()), value
else:
LOGGER().error("Get error parsed_id: %s" , repr(self.parsed_identifier))
raise DriverException("Get error parsed_id: %s" % repr(self.parsed_identifier))




Loading

0 comments on commit 1da9a33

Please sign in to comment.