Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
58 lines (44 loc) · 1.76 KB

File metadata and controls

58 lines (44 loc) · 1.76 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import glob
import unittest
from time import sleep
from appium import webdriver
PLATFORM_VERSION = '4.4'
class AndroidWebViewTests(unittest.TestCase):
def setUp(self):
app = os.path.abspath(
os.path.join(os.path.dirname(__file__),
'../../apps/selendroid-test-app.apk'))
desired_caps = {
'app': app,
'appPackage': 'io.selendroid.testapp',
'appActivity': '.HomeScreenActivity',
'platformName': 'Android',
'platformVersion': PLATFORM_VERSION,
'deviceName': 'Android Emulator'
}
if (PLATFORM_VERSION != '4.4'):
desired_caps['automationName'] = 'selendroid'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
desired_caps)
def test_webview(self):
if (PLATFORM_VERSION == '4.4'):
button = self.driver.find_element_by_accessibility_id('buttonStartWebviewCD')
else:
button = self.driver.find_element_by_name('buttonStartWebviewCD')
button.click()
self.driver.switch_to.context('WEBVIEW_0')
input_field = self.driver.find_element_by_id('name_input')
sleep(1)
input_field.clear()
input_field.send_keys('Appium User')
input_field.submit()
# test that everything is a-ok
source = self.driver.page_source
self.assertNotEqual(-1, source.find('This is my way of saying hello'))
self.assertNotEqual(-1, source.find('"Appium User"'))
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(AndroidWebViewTests)
unittest.TextTestRunner(verbosity=2).run(suite)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.