vchrome 0.0.0__py3-none-any.whl → 0.0.2__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.
- vchrome/__init__.py +27 -15
- {vchrome-0.0.0.dist-info → vchrome-0.0.2.dist-info}/METADATA +1 -1
- vchrome-0.0.2.dist-info/RECORD +5 -0
- vchrome-0.0.0.dist-info/RECORD +0 -5
- {vchrome-0.0.0.dist-info → vchrome-0.0.2.dist-info}/WHEEL +0 -0
- {vchrome-0.0.0.dist-info → vchrome-0.0.2.dist-info}/top_level.txt +0 -0
vchrome/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__version__ = '0.0.
|
|
1
|
+
__version__ = '0.0.2'
|
|
2
2
|
__author__ = 'v'
|
|
3
3
|
# ----------------------------------------------------------------------------------------------------
|
|
4
4
|
_allowed = {'Chrome'}
|
|
@@ -1100,7 +1100,7 @@ def cdp_client(hostname, port, debug=False):
|
|
|
1100
1100
|
raise Exception('wait show over time.')
|
|
1101
1101
|
time.sleep(0.08)
|
|
1102
1102
|
if pretime:
|
|
1103
|
-
time.sleep(pretime) #
|
|
1103
|
+
time.sleep(pretime) # When the component appears, the event might not have been attached yet. Please wait a moment.
|
|
1104
1104
|
def drag(self, x=1, y=2, zero='center', button='left', count=1):
|
|
1105
1105
|
self.wait_show()
|
|
1106
1106
|
self._set_in_view()
|
|
@@ -1162,8 +1162,9 @@ def cdp_client(hostname, port, debug=False):
|
|
|
1162
1162
|
self.wait_show()
|
|
1163
1163
|
if try_use_img and self.className == 'HTMLImageElement':
|
|
1164
1164
|
try:
|
|
1165
|
-
#
|
|
1166
|
-
#
|
|
1165
|
+
# If it’s an <img> tag, try to capture it via the element first; if that fails, fall back to a screenshot.
|
|
1166
|
+
# Images from <img> tags are best captured as native images for better quality.
|
|
1167
|
+
# Of course, you can also set try_use_img=False to disable this method and use screenshots only, which makes the process more uniform.
|
|
1167
1168
|
src = self['src']
|
|
1168
1169
|
if src:
|
|
1169
1170
|
if src.startswith('http'):
|
|
@@ -1362,9 +1363,19 @@ def cdp_client(hostname, port, debug=False):
|
|
|
1362
1363
|
_trav(snode)
|
|
1363
1364
|
_trav(rnode)
|
|
1364
1365
|
return clist
|
|
1366
|
+
def _get_doc_tree(self):
|
|
1367
|
+
start = perf_counter()
|
|
1368
|
+
while True:
|
|
1369
|
+
doc = self.f.cdp('DOM.getDocument', {'depth':-1, 'pierce':True})
|
|
1370
|
+
if 'root' in doc:
|
|
1371
|
+
return doc
|
|
1372
|
+
else:
|
|
1373
|
+
time.sleep(0.1)
|
|
1374
|
+
if perf_counter() - start > 2:
|
|
1375
|
+
break
|
|
1365
1376
|
def _get_flattened_node(self, nodeId=None):
|
|
1366
1377
|
if nodeId == None:
|
|
1367
|
-
rnode = self.
|
|
1378
|
+
rnode = self._get_doc_tree()['root']
|
|
1368
1379
|
else:
|
|
1369
1380
|
rnode = self.f.cdp('DOM.describeNode', {'nodeId':nodeId, 'depth':-1, 'pierce':True})['node']
|
|
1370
1381
|
mnodes = {"nodes": self._trav_node_tree(rnode)}
|
|
@@ -1961,8 +1972,8 @@ def cdp_client(hostname, port, debug=False):
|
|
|
1961
1972
|
# 'sourcePort': 443,
|
|
1962
1973
|
# 'sourceScheme': 'Secure',
|
|
1963
1974
|
# 'value': '2826F2D60D5E56C841B9E33F82051E8A'},...]
|
|
1964
|
-
# str
|
|
1965
|
-
# list
|
|
1975
|
+
# A str applies to the current URL page and can only be executed after visiting the page.
|
|
1976
|
+
# A list is used to perfectly restore the cookies state and can be executed before visiting the page.
|
|
1966
1977
|
raise Exception('cookies must be (str/list/CookieManager)')
|
|
1967
1978
|
def _get_remote_list(self):
|
|
1968
1979
|
_self = self
|
|
@@ -2196,7 +2207,8 @@ def cdp_client(hostname, port, debug=False):
|
|
|
2196
2207
|
else:
|
|
2197
2208
|
pf = finfo.get('parent')
|
|
2198
2209
|
if not pf:
|
|
2199
|
-
#
|
|
2210
|
+
# TODO
|
|
2211
|
+
# This branch is only taken during the initialization phase, when the frame has not yet entered object management.
|
|
2200
2212
|
return
|
|
2201
2213
|
lf = AbsFrame(rootf, {
|
|
2202
2214
|
"contextId": finfo.get("contextId"),
|
|
@@ -2551,13 +2563,13 @@ class Chrome:
|
|
|
2551
2563
|
height: '5px',
|
|
2552
2564
|
backgroundColor: 'red',
|
|
2553
2565
|
borderRadius: '50%',
|
|
2554
|
-
pointerEvents: 'none',
|
|
2555
|
-
userSelect: 'none',
|
|
2556
|
-
webkitUserSelect: 'none',
|
|
2557
|
-
mozUserSelect: 'none',
|
|
2558
|
-
msUserSelect: 'none',
|
|
2559
|
-
zIndex: '2147483647',
|
|
2560
|
-
willChange: 'transform',
|
|
2566
|
+
pointerEvents: 'none',
|
|
2567
|
+
userSelect: 'none',
|
|
2568
|
+
webkitUserSelect: 'none',
|
|
2569
|
+
mozUserSelect: 'none',
|
|
2570
|
+
msUserSelect: 'none',
|
|
2571
|
+
zIndex: '2147483647',
|
|
2572
|
+
willChange: 'transform',
|
|
2561
2573
|
});
|
|
2562
2574
|
document.body.appendChild(nDiv)
|
|
2563
2575
|
setTimeout(function(){ nDiv.remove(); },1000)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
vchrome/__init__.py,sha256=GaD-j4I3g4mHbDtGiCd8-5M7iXKaC7CWJiXqJH_XXyk,205606
|
|
2
|
+
vchrome-0.0.2.dist-info/METADATA,sha256=irZzBMagQl2VCh9fQTf-sLyWJOLcc2f0P4TWbvRpRBM,54
|
|
3
|
+
vchrome-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
vchrome-0.0.2.dist-info/top_level.txt,sha256=oB919Fa09PCy48Ptj8iy-1QUcvhEeY97MOR42281Fk0,8
|
|
5
|
+
vchrome-0.0.2.dist-info/RECORD,,
|
vchrome-0.0.0.dist-info/RECORD
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
vchrome/__init__.py,sha256=0kIovhQyN2I2MGbc7GfqQxZoEBPxN4ALaiL5fk8utX8,205268
|
|
2
|
-
vchrome-0.0.0.dist-info/METADATA,sha256=Ir4Nm9UhfuSB1-rBnjIcDSXOsLBOAN1OvjIpNcyXBa4,54
|
|
3
|
-
vchrome-0.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
-
vchrome-0.0.0.dist-info/top_level.txt,sha256=oB919Fa09PCy48Ptj8iy-1QUcvhEeY97MOR42281Fk0,8
|
|
5
|
-
vchrome-0.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|