Skip to content

Commit

Permalink
Merge pull request #236 from serhatbolsu/feature/execute_script_versi…
Browse files Browse the repository at this point in the history
…on_prepare

Prepare for 1.5, visit CHANGES.rst for changes
  • Loading branch information
serhatbolsu authored Nov 19, 2018
2 parents 202cf85 + 2eb3eae commit 6c467ea
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 7 deletions.
3 changes: 2 additions & 1 deletion AppiumLibrary/keywords/_android_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def set_location(self, latitude, longitude, altitude=10):
- _longitude_
- _altitude_ = 10 [optional]
Android only
Android only.
New in AppiumLibrary 1.5
"""
driver = self._current_application()
driver.set_location(latitude,longitude,altitude)
34 changes: 33 additions & 1 deletion AppiumLibrary/keywords/_applicationmanagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def close_all_applications(self):
def open_application(self, remote_url, alias=None, **kwargs):
"""Opens a new application to given Appium server.
Capabilities of appium server, Android and iOS,
Please check http://appium.io/slate/en/master/?python#appium-server-capabilities
Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md
| *Option* | *Man.* | *Description* |
| remote_url | Yes | Appium server url |
| alias | no | alias |
Expand Down Expand Up @@ -186,6 +186,34 @@ def log_source(self, loglevel='INFO'):
else:
return ''

def execute_script(self, script):
"""
Inject a snippet of JavaScript into the page for execution in the
context of the currently selected frame (Web context only).
The executed script is assumed to be synchronous and the result
of evaluating the script is returned to the client.
New in AppiumLibrary 1.5
"""
return self._current_application().execute_script(script)

def execute_async_script(self, script):
"""
Inject a snippet of Async-JavaScript into the page for execution in the
context of the currently selected frame (Web context only).
The executed script is assumed to be asynchronous and must signal that is done by
invoking the provided callback, which is always provided as the final argument to the
function.
The value to this callback will be returned to the client.
New in AppiumLibrary 1.5
"""
return self._current_application().execute_async_script(script)

def go_back(self):
"""Goes one step backward in the browser history."""
self._current_application().back()
Expand All @@ -208,12 +236,16 @@ def touch_id(self, match=True):
Simulate Touch ID on iOS Simulator
`match` (boolean) whether the simulated fingerprint is valid (default true)
New in AppiumLibrary 1.5
"""
self._current_application().touch_id(match)

def toggle_touch_id_enrollment(self):
"""
Toggle Touch ID enrolled state on iOS Simulator
New in AppiumLibrary 1.5
"""
self._current_application().toggle_touch_id_enrollment()

Expand Down
7 changes: 6 additions & 1 deletion AppiumLibrary/keywords/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
from robot.libraries.BuiltIn import BuiltIn
from robot.libraries.BuiltIn import RobotNotRunningError
from robot.api import logger
from .keywordgroup import KeywordGroup

Expand All @@ -13,7 +14,11 @@ class _LoggingKeywords(KeywordGroup):

@property
def _log_level(self):
return BuiltIn().get_variable_value("${APPIUM_LOG_LEVEL}", default='DEBUG')
try:
level = BuiltIn().get_variable_value("${APPIUM_LOG_LEVEL}", default='DEBUG')
except RobotNotRunningError:
level = 'DEBUG'
return level

def _debug(self, message):
if self._log_level in self.LOG_LEVEL_DEBUG:
Expand Down
2 changes: 1 addition & 1 deletion AppiumLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

VERSION = '1.4.6'
VERSION = '1.5'
11 changes: 11 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
History
=======
1.5
----------------
- iOS predicates selector - new locator strategy
- Execute Sync/Async Script in Web context - new keyword added
- Long press has time parameter now
- Added log-level filter for reporting
- Set Location Keyword - new keyword added
- Appium-Python library min-version bump
- Simulate Touch ID on iOS Simulator


1.4.5
----------------
- Swipe By Percent - new keyword added
Expand Down
6 changes: 3 additions & 3 deletions docs/AppiumLibrary.html

Large diffs are not rendered by default.

0 comments on commit 6c467ea

Please sign in to comment.