Skip to content

Commit 07180f7

Browse files
authored
add finger print (#252)
* add fingre print * apply auto format
1 parent 238ca0e commit 07180f7

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

appium/webdriver/mobilecommand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ class MobileCommand(object):
7373
SET_CLIPBOARD = 'setClipboard'
7474
GET_CLIPBOARD = 'getClipboard'
7575
COMPARE_IMAGES = 'compareImages'
76+
FINGER_PRINT = 'fingerPrint'

appium/webdriver/webdriver.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,14 @@ def battery_info(self):
13871387
"""
13881388
return self.execute_script('mobile: batteryInfo')
13891389

1390+
def finger_print(self, finger_id):
1391+
"""
1392+
Authenticate users by using their finger print scans on supported emulators.
1393+
1394+
:param finger_id: Finger prints stored in Android Keystore system (from 1 to 10)
1395+
"""
1396+
return self.execute(Command.FINGER_PRINT, {'fingerprintId': finger_id})['value']
1397+
13901398
# pylint: disable=protected-access
13911399

13921400
def _addCommands(self):
@@ -1505,3 +1513,5 @@ def _addCommands(self):
15051513
('POST', '/session/$sessionId/appium/device/get_clipboard')
15061514
self.command_executor._commands[Command.COMPARE_IMAGES] = \
15071515
('POST', '/session/$sessionId/appium/compare_images')
1516+
self.command_executor._commands[Command.FINGER_PRINT] = \
1517+
('POST', '/session/$sessionId/appium/device/finger_print')
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import unittest
17+
18+
from appium import webdriver
19+
import desired_capabilities
20+
21+
22+
class FingerPrintTests(unittest.TestCase):
23+
def setUp(self):
24+
desired_caps = desired_capabilities.get_desired_capabilities('ApiDemos-debug.apk')
25+
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
26+
27+
def tearDown(self):
28+
self.driver.quit()
29+
30+
def test_finger_print(self):
31+
result = self.driver.finger_print(1)
32+
self.assertEqual(None, result)
33+
34+
35+
if __name__ == "__main__":
36+
suite = unittest.TestLoader().loadTestsFromTestCase(FingerPrintTests)
37+
unittest.TextTestRunner(verbosity=2).run(suite)

0 commit comments

Comments
 (0)