forked from penguinho/appium-old
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start of Selenium WebDriver API support.
- Loading branch information
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bottle>=0.10.11 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env sh | ||
python server.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from applecart import Applecart | ||
from bottle import Bottle, request, response | ||
from bottle import run, static_file | ||
import json | ||
from time import time | ||
|
||
app = Bottle() | ||
|
||
@app.get('/favicon.ico') | ||
def get_favicon(): | ||
return static_file('favicon.ico', root='.') | ||
|
||
@app.route('/status', method='GET') | ||
def status(): | ||
status = {'sessionId': None, | ||
'status': 0, | ||
'value': {'build': {'version': 'Applecart 1.0'}}} | ||
return status | ||
|
||
@app.route('/session', method='POST') | ||
def create_session(): | ||
#TODO: Get app name from desired caps and start with applecart here | ||
# app.ios_client = Applecart('/path/to/your/awesome.app') | ||
# app.ios_client.start() | ||
response = {'sessionId': '1', | ||
'status': 0, | ||
'value': None} | ||
return response | ||
|
||
@app.route('/session/<session_id>', method='DELETE') | ||
def delete_session(session_id=''): | ||
app.ios_client.stop() | ||
response = {'sessionId': '1', | ||
'status': 0, | ||
'value': None} | ||
return response | ||
|
||
@app.route('/session/<session_id>/frame', method='POST') | ||
def switch_to_frame(session_id=''): | ||
status = 0 | ||
request_data = request.body.read() | ||
try: | ||
frame = json.loads(request_data).get('id') | ||
if frame is None: | ||
app.ios_client.proxy('wd_frame = mainWindow') | ||
else: | ||
app.ios_client.proxy('wd_frame = %s' % frame) | ||
except: | ||
response.status = 400 | ||
status = 13 # UnknownError | ||
|
||
response = {'sessionId': '1', | ||
'status': status, | ||
'value': {}} | ||
return response | ||
|
||
@app.route('/session/<session_id>/element', method='POST') | ||
def find_element(session_id=''): | ||
status = 0 | ||
request_data = request.body.read() | ||
try: | ||
locator_strategy = json.loads(request_data).get('using') | ||
element_id = json.loads(request_data).get('value') | ||
element_var_name = 'wde' + str(int(time() * 1000000)) | ||
except: | ||
response.status = 400 | ||
status = 13 # UnknownError | ||
response = {'sessionId': '1', | ||
'status': status, | ||
'value': {'message':'Unknown Error'}} | ||
return response | ||
|
||
|
||
#run(app, server='paste', host='0.0.0.0', port=8080, reloader=True) | ||
run(app, host='0.0.0.0', port=8080, reloader=True) |