docker-android/example/android/python/msite_simple_default_browser.py

36 lines
1,021 B
Python
Raw Normal View History

2017-01-30 14:29:47 +00:00
import unittest
2017-06-02 13:49:55 +01:00
from time import sleep
2017-01-30 14:29:47 +00:00
from appium import webdriver
class MSiteDefaultBrowserAndroidUITests(unittest.TestCase):
def setUp(self):
2017-04-24 14:50:18 +01:00
# Default browser does not exist for android >= 6.0
2017-01-30 14:29:47 +00:00
desired_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'appPackage': 'com.android.browser',
'appActivity': 'com.android.browser.BrowserActivity',
2017-05-29 13:34:35 +01:00
'browserName': 'browser'
2017-01-30 14:29:47 +00:00
}
2017-06-02 14:30:51 +01:00
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
2017-01-30 14:29:47 +00:00
2017-01-31 10:22:32 +00:00
def test_open_url(self):
2017-06-02 13:49:55 +01:00
self.driver.get('http://google.com')
search = self.driver.find_element_by_name('q')
search.send_keys('butomo1989 docker-android')
search.submit()
sleep(2)
2017-01-30 14:29:47 +00:00
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(MSiteDefaultBrowserAndroidUITests)
unittest.TextTestRunner(verbosity=2).run(suite)