Skip to content Skip to sidebar Skip to footer

Automate The Installation Of Ucbrowser

I am trying to automate the installation of UC browser. I able to reach to the final 'Enter UC' button (below screenshot) button activity.I need to simulate the click on 'Enter UC'

Solution 1:

UC Browser implements its UI with a custom View (as you can see from the dump) then it's not possible for UiAutomator or similar tools to get an insight of its components.

There are no many alternatives left then. You can use AndroidViewClient/culebra or CulebraTester to swipe through the first screens but when the last one is reached you should have to touch using screen coordinates.

Touch Point (x,y)

The generated script (python in this case but you can also generate java):

#! /usr/bin/env python# -*- coding: utf-8 -*-'''
Copyright (C) 2013-2016  Diego Torres Milano
Created on 2017-05-06 by CulebraTester 
                      __    __    __    __
                     /  \  /  \  /  \  /  \ 
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \ 
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''import re
import sys
import os


import unittest
try:
    sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
    passimport pkg_resources
pkg_resources.require('androidviewclient>=12.4.0')
from com.dtmilano.android.viewclient import ViewClient, CulebraTestCase
from com.dtmilano.android.uiautomator.uiautomatorhelper import UiAutomatorHelper, UiScrollable, UiObject, UiObject2

TAG = 'CULEBRA'classCulebraTests(CulebraTestCase):

    @classmethoddefsetUpClass(cls):
        cls.kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
        cls.kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': True, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True}
        cls.options = {'start-activity': None, 'concertina': False, 'device-art': None, 'use-jar': False, 'multi-device': False, 'unit-test-class': True, 'save-screenshot': None, 'use-dictionary': False, 'glare': False, 'dictionary-keys-from': 'id', 'scale': 1, 'find-views-with-content-description': True, 'window': -1, 'orientation-locked': None, 'save-view-screenshots': None, 'find-views-by-id': True, 'log-actions': False, 'use-regexps': False, 'null-back-end': False, 'auto-regexps': None, 'do-not-verify-screen-dump': True, 'verbose-comments': False, 'gui': False, 'find-views-with-text': True, 'prepend-to-sys-path': False, 'install-apk': None, 'drop-shadow': False, 'output': None, 'unit-test-method': None, 'interactive': False}
        cls.sleep = 5defsetUp(self):
        super(CulebraTests, self).setUp()

    deftearDown(self):
        super(CulebraTests, self).tearDown()

    defpreconditions(self):
        ifnotsuper(CulebraTests, self).preconditions():
            returnFalsereturnTruedeftestSomething(self):
        ifnot self.preconditions():
            self.fail('Preconditions failed')

        _s = CulebraTests.sleep
        _v = CulebraTests.verbose

        self.vc.click(x=520, y=1603)
        self.vc.sleep(_s)

if __name__ == '__main__':
    CulebraTests.main()

Post a Comment for "Automate The Installation Of Ucbrowser"