mangoautomation 1.0.55__py3-none-any.whl → 1.0.57__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mangoautomation might be problematic. Click here for more details.

@@ -14,7 +14,8 @@ from ..uidrive.web.sync_web._new_browser import SyncWebNewBrowser
14
14
 
15
15
  class DriverObject:
16
16
 
17
- def __init__(self, is_async=False):
17
+ def __init__(self, log, is_async=False):
18
+ self.log = log
18
19
  self.is_async = is_async
19
20
  self.web: Optional[AsyncWebNewBrowser | SyncWebNewBrowser] = None
20
21
  self.android: Optional[NewAndroid] = None
@@ -41,7 +42,8 @@ class DriverObject:
41
42
  web_h5,
42
43
  is_header_intercept,
43
44
  web_is_default,
44
- videos_path
45
+ videos_path,
46
+ log=self.log,
45
47
  )
46
48
  else:
47
49
  self.web = SyncWebNewBrowser(
@@ -53,7 +55,8 @@ class DriverObject:
53
55
  web_h5,
54
56
  is_header_intercept,
55
57
  web_is_default,
56
- videos_path
58
+ videos_path,
59
+ log=self.log,
57
60
  )
58
61
 
59
62
  def set_android(self, and_equipment: str):
@@ -35,7 +35,8 @@ class AsyncWebNewBrowser:
35
35
  web_h5=None,
36
36
  is_header_intercept=False,
37
37
  web_is_default=False,
38
- videos_path=None
38
+ videos_path=None,
39
+ log=None,
39
40
  ):
40
41
  self.lock = asyncio.Lock()
41
42
  self.web_type = web_type
@@ -47,6 +48,7 @@ class AsyncWebNewBrowser:
47
48
  self.web_is_default = web_is_default
48
49
  self.is_header_intercept = is_header_intercept
49
50
  self.videos_path = videos_path
51
+ self.log = log
50
52
  self.browser_path = ['chrome.exe', 'msedge.exe', 'firefox.exe', '苹果', '360se.exe']
51
53
  self.browser: Optional[None | Browser] = None
52
54
  self.playwright: Optional[None | Playwright] = None
@@ -61,9 +63,9 @@ class AsyncWebNewBrowser:
61
63
  context = await self.new_context()
62
64
  page = await self.new_page(context)
63
65
  return context, page
64
- except Exception as error:
66
+ except Exception:
67
+ self.log.error(f'初始化page失败,错误信息:{traceback.format_exc()}')
65
68
  self.browser = None
66
- print(traceback.format_exc())
67
69
  if count >= 3:
68
70
  raise MangoAutomationError(*ERROR_MSG_0057)
69
71
  else:
@@ -82,7 +84,8 @@ class AsyncWebNewBrowser:
82
84
  if self.web_is_default:
83
85
  try:
84
86
  return await browser.launch()
85
- except Error:
87
+ except Error as error:
88
+ self.log.error(f'初始化浏览器失败-1,类型:{error},详情:{traceback.format_exc()}')
86
89
  raise MangoAutomationError(*ERROR_MSG_0062)
87
90
  else:
88
91
  try:
@@ -97,7 +100,8 @@ class AsyncWebNewBrowser:
97
100
  headless=self.web_headers,
98
101
  executable_path=self.web_path if self.web_path else self.__search_path()
99
102
  )
100
- except Error:
103
+ except Error as error:
104
+ self.log.error(f'初始化浏览器失败-2,类型:{error},详情:{traceback.format_exc()}')
101
105
  raise MangoAutomationError(*ERROR_MSG_0009, value=(self.web_path,))
102
106
 
103
107
  async def new_context(self) -> BrowserContext:
@@ -115,10 +119,12 @@ class AsyncWebNewBrowser:
115
119
  async def new_page(self, context: BrowserContext) -> Page:
116
120
  try:
117
121
  page = await context.new_page()
122
+ page.set_default_timeout(3000)
118
123
  if self.is_header_intercept:
119
124
  await page.route("**/*", self.wen_intercept_request) # 应用拦截函数到页面的所有请求
120
125
  return page
121
- except Error:
126
+ except Error as error:
127
+ self.log.error(f'初始化page失败,类型:{error},详情:{traceback.format_exc()}')
122
128
  raise MangoAutomationError(*ERROR_MSG_0009, value=(self.web_path,))
123
129
 
124
130
  async def close(self):
@@ -24,7 +24,6 @@ from ....exceptions import MangoAutomationError
24
24
  from ....exceptions._error_msg import ERROR_MSG_0057, ERROR_MSG_0008, ERROR_MSG_0062, ERROR_MSG_0009, ERROR_MSG_0055
25
25
 
26
26
 
27
-
28
27
  class SyncWebNewBrowser:
29
28
 
30
29
  def __init__(self,
@@ -36,7 +35,8 @@ class SyncWebNewBrowser:
36
35
  web_h5=None,
37
36
  is_header_intercept=False,
38
37
  web_is_default=False,
39
- videos_path=None
38
+ videos_path=None,
39
+ log=None,
40
40
  ):
41
41
  self.lock = threading.Lock()
42
42
  self.web_type = web_type
@@ -48,6 +48,7 @@ class SyncWebNewBrowser:
48
48
  self.web_is_default = web_is_default
49
49
  self.videos_path = videos_path
50
50
  self.is_header_intercept = is_header_intercept
51
+ self.log = log
51
52
  self.browser_path = ['chrome.exe', 'msedge.exe', 'firefox.exe', '苹果', '360se.exe']
52
53
  self.browser: Optional[None | Browser] = None
53
54
  self.playwright: Optional[None | Playwright] = None
@@ -55,15 +56,16 @@ class SyncWebNewBrowser:
55
56
  def new_web_page(self, count=0) -> tuple[BrowserContext, Page]:
56
57
  if self.browser is None:
57
58
  with self.lock:
58
- self.browser = self.new_browser()
59
- time.sleep(1)
59
+ if self.browser is None:
60
+ self.browser = self.new_browser()
61
+ time.sleep(1)
60
62
  try:
61
63
  context = self.new_context()
62
64
  page = self.new_page(context)
63
65
  return context, page
64
- except Exception as error:
66
+ except Exception:
67
+ self.log.error(f'初始化page失败,错误信息:{traceback.format_exc()}')
65
68
  self.browser = None
66
- traceback.format_exc()
67
69
  if count >= 3:
68
70
  raise MangoAutomationError(*ERROR_MSG_0057)
69
71
  else:
@@ -82,7 +84,8 @@ class SyncWebNewBrowser:
82
84
  if self.web_is_default:
83
85
  try:
84
86
  return browser.launch()
85
- except Error:
87
+ except Error as error:
88
+ self.log.error(f'初始化浏览器失败-1,类型:{error},详情:{traceback.format_exc()}')
86
89
  raise MangoAutomationError(*ERROR_MSG_0062)
87
90
  else:
88
91
  try:
@@ -97,7 +100,8 @@ class SyncWebNewBrowser:
97
100
  headless=self.web_headers,
98
101
  executable_path=self.web_path if self.web_path else self.__search_path()
99
102
  )
100
- except Error:
103
+ except Error as error:
104
+ self.log.error(f'初始化浏览器失败-2,类型:{error},详情:{traceback.format_exc()}')
101
105
  raise MangoAutomationError(*ERROR_MSG_0009, value=(self.web_path,))
102
106
 
103
107
  def new_context(self) -> BrowserContext:
@@ -115,10 +119,12 @@ class SyncWebNewBrowser:
115
119
  def new_page(self, context: BrowserContext) -> Page:
116
120
  try:
117
121
  page = context.new_page()
122
+ page.set_default_timeout(3000)
118
123
  if self.is_header_intercept:
119
124
  page.route("**/*", self.wen_intercept_request) # 应用拦截函数到页面的所有请求
120
125
  return page
121
- except Error:
126
+ except Error as error:
127
+ self.log.error(f'初始化page失败,类型:{error},详情:{traceback.format_exc()}')
122
128
  raise MangoAutomationError(*ERROR_MSG_0009, value=(self.web_path,))
123
129
 
124
130
  def close(self):
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.4
2
+ Name: mangoautomation
3
+ Version: 1.0.57
4
+ Summary: 测试工具
5
+ Home-page: https://gitee.com/mao-peng/testkit
6
+ Author: 毛鹏
7
+ Author-email: 729164035@qq.com
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ License-File: LICENSE
13
+ Requires-Dist: setuptools>=68.2.0
14
+ Requires-Dist: pydantic>=2.9.2
15
+ Requires-Dist: playwright==1.43.0
16
+ Requires-Dist: uiautomation>=2.0.20
17
+ Requires-Dist: uiautomator2>=3.2.5
18
+ Requires-Dist: mangotools>=1.1.32
19
+ Requires-Dist: adbutils~=2.8.9
20
+ Requires-Dist: uiautodev>=0.9.0
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: home-page
26
+ Dynamic: license-file
27
+ Dynamic: requires-dist
28
+ Dynamic: summary
29
+
30
+ # testkit
31
+
32
+ #### 介绍
33
+
34
+ 测试工具
35
+
36
+ #### 安装教程
37
+
38
+ 1. pip install mangokit
39
+
40
+ #### 使用说明
41
+
42
+ 1.
@@ -13,7 +13,7 @@ mangoautomation/tools/_uiautodev.py,sha256=RMOQMXse744xwUDb1_l7qDv9mUiqZt1Gm5sbB
13
13
  mangoautomation/uidrive/__init__.py,sha256=3xD94fw5QQvBPMPDq2o-SiJI_zt0AdJuB_X0eAFth8g,430
14
14
  mangoautomation/uidrive/_async_element.py,sha256=-nkYBazbYlitsTIfN8XhKIM8GitQifoZ0aTqaOH05Nk,13757
15
15
  mangoautomation/uidrive/_base_data.py,sha256=ur2Ts40MAhOYXb0vGVXZdSwEVCI3Csri9I9f1pw1r4Y,3766
16
- mangoautomation/uidrive/_driver_object.py,sha256=Re8j6VLHKfwW2VFdi-1XFRuix8tRBLcHYRBLVF6CApE,1962
16
+ mangoautomation/uidrive/_driver_object.py,sha256=7RGiAIPHU_bQtwVPEprnXt-HOzoKuKn_Bu2RZxjSAVs,2055
17
17
  mangoautomation/uidrive/_sync_element.py,sha256=Zdg5LwNeZBjctpojPmjQfMgrsAAne_w_KWFwhucSlxA,13576
18
18
  mangoautomation/uidrive/android/__init__.py,sha256=SWn7PwRZOf34LCE9KigClDaV8R0n70rqLsG6hCeAok0,5499
19
19
  mangoautomation/uidrive/android/_application.py,sha256=EeEM0MPtOPeYeKx92mtMFWqGpCRmri-D_CzXvPt13RA,2800
@@ -37,7 +37,7 @@ mangoautomation/uidrive/web/async_web/_browser.py,sha256=39YroURzagpq0HoEn1RZnNf
37
37
  mangoautomation/uidrive/web/async_web/_customization.py,sha256=uw6p9uLHLXglgSkH4qjDl1v0iGlaNjvf8LljRH5cAHU,347
38
38
  mangoautomation/uidrive/web/async_web/_element.py,sha256=Si0ql_vGtgzacEaSEbglGTw96qdYHcsYEbYqgtIgYCo,10150
39
39
  mangoautomation/uidrive/web/async_web/_input_device.py,sha256=sMAMHb_8QyPx3pKci0gRDQc2O7h1OYMGyA7fCWl81iM,3288
40
- mangoautomation/uidrive/web/async_web/_new_browser.py,sha256=WsQ-s2QCjXiePN_u4bLwpds_QpuDd9V2w6hLuLCB-zg,5624
40
+ mangoautomation/uidrive/web/async_web/_new_browser.py,sha256=eCXa_WqCZfaom-PSBR9nM5x1XBQCPswUFT4134d3WDE,6133
41
41
  mangoautomation/uidrive/web/async_web/_page.py,sha256=TCYf79qQdVBBTTNq2COZFJVcLCgg5Ksu9lMgmQPVInU,2147
42
42
  mangoautomation/uidrive/web/sync_web/__init__.py,sha256=31U15FJftsv6yyDlKT-2zN0CNPyolZPRuPh7mdeKKas,7961
43
43
  mangoautomation/uidrive/web/sync_web/_assertion.py,sha256=hVA7-Z3CfPgkmtnK_3M5UGo6sct88W6AJfQTnrqu9jU,12534
@@ -45,13 +45,13 @@ mangoautomation/uidrive/web/sync_web/_browser.py,sha256=c7xHkIIFPawlzcVkGjwqeKfW
45
45
  mangoautomation/uidrive/web/sync_web/_customization.py,sha256=E_pfI8gKd0O6r4huJIvA6hoW-X9fSDVL4zEUqhHgxwE,355
46
46
  mangoautomation/uidrive/web/sync_web/_element.py,sha256=KkgLxGVwdl4JhRkIbGrUA12BmHohggdalEGlnztyrSE,9783
47
47
  mangoautomation/uidrive/web/sync_web/_input_device.py,sha256=8t6tJgMb4zgb4Sv02XP3gUU0ZVbApCs3WaILv8Fe1iY,3169
48
- mangoautomation/uidrive/web/sync_web/_new_browser.py,sha256=LNwhzjf0SbsBAaIXD_bEq623MsX2RvSdLc6tIt1ygjA,5516
48
+ mangoautomation/uidrive/web/sync_web/_new_browser.py,sha256=5gd0Z2wyou0WCTPcMTjzos_3duB59djKJyTCXyULIZ8,6080
49
49
  mangoautomation/uidrive/web/sync_web/_page.py,sha256=MNekcL7o5YXEloeuvi3YrpOZxGhEWfrq-5i4PbtTLFg,2027
50
+ mangoautomation-1.0.57.dist-info/licenses/LICENSE,sha256=03WP-mgFmo8ofRYDe1HVDQUEUKQZ2q6P6Q-2A4c-46A,1085
50
51
  tests/__init__.py,sha256=UhCNFqiVjxdh4CXESNo4oE7qfjpYYVkeHbSE5-7LGDY,125
51
52
  tests/test_ui_and.py,sha256=4k0_3bx_k2KbZifeRWGK65sxtdiPUOjkNzZ5oxjrc18,672
52
53
  tests/test_ui_web.py,sha256=MFaUN8O5qKOMMgyk2eelhKZsYcSJm0Do6pCgsdBZEH4,2765
53
- mangoautomation-1.0.55.dist-info/LICENSE,sha256=03WP-mgFmo8ofRYDe1HVDQUEUKQZ2q6P6Q-2A4c-46A,1085
54
- mangoautomation-1.0.55.dist-info/METADATA,sha256=7rVCyRtGhPYGYHzP0RTjDkAPYWzSGiFNlSN6RQvuG5o,816
55
- mangoautomation-1.0.55.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
56
- mangoautomation-1.0.55.dist-info/top_level.txt,sha256=g-uCmjvEODG8WFbmwbGM0-G0zHntHv8ZsS0PQRaMGtE,22
57
- mangoautomation-1.0.55.dist-info/RECORD,,
54
+ mangoautomation-1.0.57.dist-info/METADATA,sha256=LzBvQcMwyNfDpuTQfEAWe68y1Lcc3iVhXZaXEXouKpI,976
55
+ mangoautomation-1.0.57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
+ mangoautomation-1.0.57.dist-info/top_level.txt,sha256=g-uCmjvEODG8WFbmwbGM0-G0zHntHv8ZsS0PQRaMGtE,22
57
+ mangoautomation-1.0.57.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,34 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: mangoautomation
3
- Version: 1.0.55
4
- Summary: 测试工具
5
- Home-page: https://gitee.com/mao-peng/testkit
6
- Author: 毛鹏
7
- Author-email: 729164035@qq.com
8
- Classifier: Programming Language :: Python :: 3.10
9
- Classifier: Programming Language :: Python :: 3.11
10
- Classifier: Programming Language :: Python :: 3.12
11
- Classifier: Programming Language :: Python :: 3.13
12
- License-File: LICENSE
13
- Requires-Dist: setuptools >=68.2.0
14
- Requires-Dist: pydantic >=2.9.2
15
- Requires-Dist: playwright >=1.43.0
16
- Requires-Dist: uiautomation >=2.0.20
17
- Requires-Dist: uiautomator2 >=3.2.5
18
- Requires-Dist: mangotools >=1.1.28
19
- Requires-Dist: adbutils ~=2.8.9
20
- Requires-Dist: uiautodev >=0.9.0
21
-
22
- # testkit
23
-
24
- #### 介绍
25
-
26
- 测试工具
27
-
28
- #### 安装教程
29
-
30
- 1. pip install mangokit
31
-
32
- #### 使用说明
33
-
34
- 1.