ferridriver 0.4.0

Browser automation in Rust with a Playwright-compatible API. Four pluggable backends: CDP pipe, CDP WebSocket, Playwright WebKit, Firefox BiDi.
Documentation
1
2
3
4
5
6
7
8
9
(()=>{function d(n){n=n||document;let i=[],e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);while(e.nextNode()){let o=e.currentNode;if(i.push(o),o.shadowRoot){let t=d(o.shadowRoot);i.push(...t)}}return i}function h(n,i,e,o,t,r){let c;try{c=i?new RegExp(n,e?"g":"gi"):new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e?"g":"gi")}catch{return JSON.stringify({error:"Invalid pattern"})}let a=(t?document.querySelector(t)||document.body:document.body).innerText||"",s=[],u;while((u=c.exec(a))&&s.length<r){let f=Math.max(0,u.index-o),p=Math.min(a.length,u.index+u[0].length+o);s.push({match_text:u[0],context:a.slice(f,p),element_path:"",char_position:u.index})}return JSON.stringify({total:s.length,has_more:!1,matches:s})}function y(n,i,e,o){try{let t=[...document.querySelectorAll(n)].slice(0,e);return JSON.stringify(t.map((r,c)=>{let l={index:c,tag:r.tagName.toLowerCase()};for(let a of i){let s=r.getAttribute(a);if(s!==null)l[a]=s}if(o)l.text=(r.textContent||"").trim().slice(0,200);return l}))}catch(t){return JSON.stringify({error:t.message})}}function b(){let n=[...document.querySelectorAll("[id]")].map((e)=>e.id).filter(Boolean).slice(0,50),i=[...document.querySelectorAll("input,textarea,select,button,a")].map((e)=>{let o=e.tagName.toLowerCase(),t=e.id?`#${e.id}`:"",r=e.getAttribute("name")?`[name="${e.getAttribute("name")}"]`:"",c=e.getAttribute("type")?`[type="${e.getAttribute("type")}"]`:"";return`${o}${t}${r}${c}`}).slice(0,50);return JSON.stringify({ids:n,inputs:i})}var m=0,g=!1;function x(){if(!g){g=!0;let n=console.error;console.error=function(...i){m++,n.apply(console,i)}}return m}function E(){let n=document.body.cloneNode(!0);n.querySelectorAll("script,style,noscript,svg,iframe").forEach((e)=>e.remove());function i(e){if(e.nodeType===3)return(e.textContent||"").replace(/\s+/g," ");if(e.nodeType!==1)return"";let o=e,t=o.tagName.toLowerCase(),r=[...o.childNodes].map(i).join("");if(/^h[1-6]$/.test(t))return`
`+"#".repeat(parseInt(t[1]))+" "+r.trim()+`
`;if(t==="p"||t==="div")return`
`+r.trim()+`
`;if(t==="br")return`
`;if(t==="li")return"- "+r.trim()+`
`;if(t==="a")return`[${r.trim()}](${o.getAttribute("href")||""})`;if(t==="strong"||t==="b")return`**${r.trim()}**`;if(t==="em"||t==="i")return`*${r.trim()}*`;if(t==="code")return`\`${r.trim()}\``;if(t==="pre")return"\n```\n"+r.trim()+"\n```\n";if(t==="img")return`![${o.getAttribute("alt")||""}](${o.getAttribute("src")||""})`;return r}return i(n).replace(/\n{3,}/g,`

`).trim()}(()=>{let n=window.__fd;if(!n||n.__mcpSupport)return;n.__mcpSupport=!0,Object.assign(n,{searchPage:h,findElementsCSS:y,suggestSelectors:b,consoleErrors:x,extractMarkdown:E,allElements:d})})();})();