mobile_driver_factory
MobileDriverFactory
Handles the creation and configuration of Appium drivers for mobile automation.
Source code in libs\cafex_ui\src\cafex_ui\mobile_client\mobile_driver_factory.py
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
__init__()
Initializes the MobileDriverFactory with a logger.
Source code in libs\cafex_ui\src\cafex_ui\mobile_client\mobile_driver_factory.py
13 14 15 |
|
create_mobile_driver(mobile_os, mobile_platform, capabilities_dictionary, browserstack_username=None, browserstack_access_key=None, ip_address=None, port_number=None)
Creates and returns an Appium driver instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mobile_os
|
str
|
The mobile operating system ('android' or 'ios'). |
required |
mobile_platform
|
str
|
The platform to run on ('simulator', 'device', 'browserstack'). |
required |
capabilities_dictionary
|
dict
|
A dictionary of desired capabilities. |
required |
browserstack_username
|
str
|
BrowserStack username (required if mobile_platform is 'browserstack'). |
None
|
browserstack_access_key
|
str
|
BrowserStack access key (required if mobile_platform is 'browserstack'). |
None
|
ip_address
|
str
|
Appium server IP address (required if mobile_platform is not 'browserstack'). |
None
|
port_number
|
int
|
Appium server port number (required if mobile_platform is not 'browserstack'). |
None
|
Returns:
Type | Description |
---|---|
Remote
|
An instance of the Appium webdriver. |
Raises:
Type | Description |
---|---|
TypeError
|
If any of the required arguments are of incorrect type. |
ValueError
|
If required arguments are missing based on the 'mobile_platform' or unsupported mobile OS. |
Exception
|
If an error occurs during driver creation. |
Source code in libs\cafex_ui\src\cafex_ui\mobile_client\mobile_driver_factory.py
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
get_appium_options(mobile_os, desired_caps)
Returns the appropriate Appium options based on the mobile OS.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mobile_os
|
str
|
The mobile operating system ('android' or 'ios'). |
required |
desired_caps
|
dict
|
A dictionary of desired capabilities. |
required |
Returns:
Type | Description |
---|---|
AppiumOptions
|
An AppiumOptions object. |
Raises:
Type | Description |
---|---|
ValueError
|
If an unsupported mobile OS is provided. |
Source code in libs\cafex_ui\src\cafex_ui\mobile_client\mobile_driver_factory.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|