Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sovereign-intelligence/blob/main/docs/site/evidence/CONVERSATION-PATH-L656/browser_matrix.executed.txt # sovereign-intelligence Front door to Drake Stapleton's sovereign stack. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `sovereign-intelligence / docs / site / evidence / CONVERSATION-PATH-L656 / browser_matrix.executed.txt` 83 lines ยท 6761 bytes Raw Blame History 1 # Execute via browser_exec: helpers are injected by the browser harness. 2 import base64 3 import json 4 from pathlib import Path 5 import shutil 6 7 OUT = Path('/Users/drakestapleton/.hermes/cache/scratch/loop13-personal71/evidence/CONVERSATION-PATH-L656/browser/final') 8 OUT.mkdir(parents=True, exist_ok=False) 9 BASE = 'http://127.0.0.1:18731/' 10 cdp('Network.enable') 11 cdp('Network.setBlockedURLs', urls=['https://formsubmit.co/*']) 12 13 def enter(selector): 14 root = cdp('DOM.getDocument')['root']['nodeId'] 15 node = cdp('DOM.querySelector', nodeId=root, selector=selector)['nodeId'] 16 if not node: 17 raise RuntimeError('missing keyboard target: ' + selector) 18 cdp('DOM.focus', nodeId=node) 19 cdp('Input.dispatchKeyEvent', type='keyDown', key='Enter', code='Enter', windowsVirtualKeyCode=13, text='\r', unmodifiedText='\r') 20 cdp('Input.dispatchKeyEvent', type='keyUp', key='Enter', code='Enter', windowsVirtualKeyCode=13) 21 22 def page_probe(expected): 23 # Inspector-injected on-new-document code may run with page JS disabled. 24 # Exercise an actual page script element instead; verify both modes. 25 js('delete window.__l656PageScriptProbe;var s=document.createElement("script");s.textContent="window.__l656PageScriptProbe=123";document.head.appendChild(s);s.remove();') 26 actual = js('window.__l656PageScriptProbe===123') 27 if actual != expected: 28 raise RuntimeError('page script execution mode not proven: ' + str(actual)) 29 return actual 30 31 rows = [] 32 for label, width, height, mobile, enabled in [ 33 ('desktop',1440,900,False,True), ('phone',390,844,True,True), 34 ('desktop',1440,900,False,False), ('phone',390,844,True,False), 35 ]: 36 name = label + ('-js' if enabled else '-nojs') 37 cdp('Emulation.setScriptExecutionDisabled', value=not enabled) 38 cdp('Emulation.setDeviceMetricsOverride', width=width, height=height, deviceScaleFactor=1, mobile=mobile) 39 if not mobile: 40 zoom = cdp('Page.getLayoutMetrics')['visualViewport'].get('zoom',1) 41 cdp('Emulation.setDeviceMetricsOverride', width=round(width*zoom), height=round(height*zoom), deviceScaleFactor=1, mobile=False) 42 goto_url(BASE); wait_for_load() 43 actual_script = page_probe(enabled) 44 home = js('({url:location.href,width:innerWidth,height:innerHeight,scrollWidth:document.documentElement.scrollWidth,qa:window.__qa??null,ctas:Array.from(document.querySelectorAll(".uni-cta a")).map(a=>({name:a.textContent,href:a.getAttribute("href"),rect:a.getBoundingClientRect().toJSON()})),outsideResources:performance.getEntriesByType("resource").filter(r=>new URL(r.name).origin!==location.origin).map(r=>r.name)})') 45 if (home['width'],home['height']) != (width,height) or home['scrollWidth']>width or home['outsideResources']: 46 raise RuntimeError('homepage viewport/resource failure: '+str(home)) 47 shutil.copyfile(capture_screenshot(), OUT/(name+'-home.png')) 48 enter('.uni-cta a[href="/interest"]'); wait_for_load() 49 page_probe(enabled) 50 interest = js('({url:location.href,width:innerWidth,height:innerHeight,scrollWidth:document.documentElement.scrollWidth,qa:window.__qa??null,h1:document.querySelector("h1").textContent,h2Font:getComputedStyle(document.querySelector(".prose h2")).fontSize,forms:document.forms.length,action:document.forms[0].action,method:document.forms[0].method,valid:document.forms[0].checkValidity(),novalidate:document.forms[0].noValidate,descriptionIds:document.getElementById("message").getAttribute("aria-describedby"),labels:Array.from(document.querySelectorAll("form input:not([type=hidden]),form textarea")).map(e=>({name:e.name,label:e.labels?.[0]?.textContent,required:e.required})),mailto:document.querySelector("a[href^=mailto]").getAttribute("href"),outsideResources:performance.getEntriesByType("resource").filter(r=>new URL(r.name).origin!==location.origin).map(r=>r.name)})') 51 if '/interest' not in interest['url'] or (interest['width'],interest['height'])!=(width,height) or interest['scrollWidth']>width or interest['forms']!=1 or interest['valid'] or interest['novalidate'] or interest['outsideResources']: 52 raise RuntimeError('interest-page failure: '+str(interest)) 53 for view in [home,interest]: 54 if view['qa'] and (view['qa']['errors'] or view['qa']['messages']): 55 raise RuntimeError('console failure: '+str(view['qa'])) 56 clip = cdp('Page.getLayoutMetrics')['contentSize'] 57 (OUT/(name+'-interest-full.png')).write_bytes(base64.b64decode(cdp('Page.captureScreenshot', format='png', captureBeyondViewport=True, clip={**clip,'scale':1})['data'])) 58 enter('button[type=submit]') 59 validation = js('({url:location.href,focused:document.activeElement.id,missing:document.getElementById("name").validity.valueMissing,message:document.getElementById("name").validationMessage})') 60 if validation['focused']!='name' or not validation['missing'] or not validation['message'] or '/interest' not in validation['url']: 61 raise RuntimeError('native required-field validation failed: '+str(validation)) 62 tabs = [] 63 for _ in range(3): 64 for typ in ['keyDown','keyUp']: 65 cdp('Input.dispatchKeyEvent', type=typ, key='Tab', code='Tab', windowsVirtualKeyCode=9) 66 tabs.append(js('({id:document.activeElement.id,tag:document.activeElement.tagName,type:document.activeElement.type})')) 67 if [x['id'] for x in tabs[:2]]!=['email','message'] or tabs[2]['tag']!='BUTTON': 68 raise RuntimeError('form keyboard order failed: '+str(tabs)) 69 legacy = [] 70 for target in ['#w-home','#w-aien']: 71 goto_url(BASE); wait_for_load() 72 enter('.uni-cta a[href="'+target+'"]') 73 state = js('({hash:location.hash,visible:getComputedStyle(document.querySelector(location.hash)).display!=="none"&&getComputedStyle(document.querySelector(location.hash)).visibility!=="hidden"})') 74 if state['hash']!=target or not state['visible']: 75 raise RuntimeError('retained keyboard action failed: '+str(state)) 76 legacy.append(state) 77 rows.append({'viewport':label,'javascript':enabled,'page_script_probe_executed':actual_script,'home':home,'interest':interest,'keyboard_enter_navigated':True,'native_empty_submit_refused':validation,'third_party_submission_blocked_during_test':True,'form_tab_order':tabs,'retained_actions_keyboard':legacy}) 78 (OUT/'results.json').write_text(json.dumps(rows,indent=2)+'\n') 79 print(name,'PASS: two pages, contextual Enter, native validation, form tab order, both retained actions') 80 if len({(r['viewport'],r['javascript']) for r in rows})!=4: 81 raise RuntimeError('incomplete matrix') 82 (OUT/'complete.json').write_text(json.dumps({'states':len(rows),'page_views':len(rows)*2,'complete':True,'no_real_submission':True},indent=2)+'\n') 83 print(str(OUT/'phone-nojs-home.png'))