feat: 根目录文档、脚本、gitignore
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import io, sys
|
||||
from playwright.sync_api import sync_playwright
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch(channel='chrome', headless=True)
|
||||
page = b.new_page(viewport={'width': 1500, 'height': 950})
|
||||
page.goto('http://localhost:8088/#/product-story-info/9130', wait_until='domcontentloaded')
|
||||
page.wait_for_timeout(2500)
|
||||
if 'login' in page.url:
|
||||
page.locator('input[placeholder="用户名"]').fill('admin')
|
||||
page.locator('input[placeholder="密码"]').fill('123456')
|
||||
page.locator('text="登录"').first.click(); page.wait_for_timeout(6000)
|
||||
page.goto('http://localhost:8088/#/product-story-info/9130', wait_until='domcontentloaded')
|
||||
page.wait_for_timeout(5000)
|
||||
client = page.context.new_cdp_session(page)
|
||||
client.send('CSS.enable')
|
||||
client.send('DOM.enable')
|
||||
doc = client.send('DOM.getDocument')
|
||||
node = client.send('DOM.querySelector', {'nodeId': doc['root']['nodeId'], 'selector': '.filterInfo .el-tabs__item'})
|
||||
styles = client.send('CSS.getMatchedStylesForNode', {'nodeId': node['nodeId']})
|
||||
for m in styles.get('matchedCSSRules', []):
|
||||
sel = m['rule']['selectorList']['text']
|
||||
origin = m['rule']['origin']
|
||||
for prop in m['rule']['style']['cssProperties']:
|
||||
if 'padding' in prop.get('name','') and prop.get('value'):
|
||||
print(f"[{origin}] {sel} -> {prop['name']}: {prop['value']}" + (' !important' if prop.get('important') else ''))
|
||||
b.close()
|
||||
Reference in New Issue
Block a user