Constructor @type device: AdbClient @param device: The device running the C{View server} to which this client will connect @type serialno: str @param serialno: the serial number of the device or emulator to connect to @type adb: str @param ad
(self, device, serialno, adb=None, autodump=True, forceviewserveruse=False, localport=None,
remoteport=None, startviewserver=True, ignoreuiautomatorkilled=False, compresseddump=True,
useuiautomatorhelper=False, debug={})
| 2550 | ''' The directory used to store screenshot images ''' |
| 2551 | |
| 2552 | def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse=False, localport=None, |
| 2553 | remoteport=None, startviewserver=True, ignoreuiautomatorkilled=False, compresseddump=True, |
| 2554 | useuiautomatorhelper=False, debug={}): |
| 2555 | """ |
| 2556 | Constructor |
| 2557 | |
| 2558 | @type device: AdbClient |
| 2559 | @param device: The device running the C{View server} to which this client will connect |
| 2560 | @type serialno: str |
| 2561 | @param serialno: the serial number of the device or emulator to connect to |
| 2562 | @type adb: str |
| 2563 | @param adb: the path of the C{adb} executable or None and C{ViewClient} will try to find it |
| 2564 | @type autodump: boolean |
| 2565 | @param autodump: whether an automatic dump is performed at the end of this constructor |
| 2566 | @type forceviewserveruse: boolean |
| 2567 | @param forceviewserveruse: Force the use of C{ViewServer} even if the conditions to use |
| 2568 | C{UiAutomator} are satisfied |
| 2569 | @type localport: int |
| 2570 | @param localport: the local port used in the redirection |
| 2571 | @type remoteport: int |
| 2572 | @param remoteport: the remote port used to start the C{ViewServer} in the device or |
| 2573 | emulator |
| 2574 | @type startviewserver: boolean |
| 2575 | @param startviewserver: Whether to start the B{global} ViewServer |
| 2576 | @type ignoreuiautomatorkilled: boolean |
| 2577 | @param ignoreuiautomatorkilled: Ignores received B{Killed} message from C{uiautomator} |
| 2578 | @type compresseddump: boolean |
| 2579 | @param compresseddump: turns --compressed flag for uiautomator dump on/off |
| 2580 | @:type useuiautomatorhelper: boolean |
| 2581 | @:param useuiautomatorhelper: use UiAutomatorHelper Android app as backend |
| 2582 | """ |
| 2583 | |
| 2584 | if not device: |
| 2585 | raise Exception('Device is not connected') |
| 2586 | self.device = device |
| 2587 | ''' The C{AdbClient} device instance ''' |
| 2588 | |
| 2589 | if not serialno: |
| 2590 | raise ValueError("Serialno cannot be None") |
| 2591 | self.serialno = self.__mapSerialNo(serialno) |
| 2592 | ''' The serial number of the device ''' |
| 2593 | |
| 2594 | self.uiAutomatorHelper = None |
| 2595 | ''' The UiAutomatorHelper ''' |
| 2596 | |
| 2597 | self.ui_automator_helper_dump: Optional[WindowHierarchy] = None |
| 2598 | |
| 2599 | if useuiautomatorhelper: |
| 2600 | self.useUiAutomator = True |
| 2601 | if not localport: |
| 2602 | localport = CULEBRATESTER2_PORT |
| 2603 | if not remoteport: |
| 2604 | remoteport = CULEBRATESTER2_PORT |
| 2605 | self.uiAutomatorHelper = UiAutomatorHelper(device, localport=localport, remoteport=remoteport) |
| 2606 | # we might return here if all the dependencies to `adb` commands were removed when uiAutomatorHelper is used |
| 2607 | # return |
| 2608 | |
| 2609 | self.debug = debug |
nothing calls this directly
no test coverage detected