Skip to content

Commit

Permalink
fixed full_page parameter of save_screenshot, fixed iframe target con…
Browse files Browse the repository at this point in the history
…nections, and some nonsense
  • Loading branch information
ultrafunkamsterdam committed Apr 20, 2024
1 parent 9943eb8 commit 96b8d37
Show file tree
Hide file tree
Showing 132 changed files with 179 additions and 113 deletions.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/accessibility.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/animation.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/audits.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/autofill.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/background_service.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/browser.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/cache_storage.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/cast.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/console.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/css.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/database.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/debugger.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/device_access.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/device_orientation.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/dom.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/dom_debugger.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/dom_snapshot.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/dom_storage.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/emulation.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/event_breakpoints.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/fed_cm.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/fetch.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/headless_experimental.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/heap_profiler.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/indexed_db.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/input_.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/inspector.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/io.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/layer_tree.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/log.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/media.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/memory.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/network.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/overlay.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/page.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/performance.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/performance_timeline.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/preload.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/profiler.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/runtime.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/schema.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/security.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/service_worker.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/storage.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/system_info.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/target.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/tethering.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/tracing.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/web_audio.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/cdp/web_authn.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/classes/browser.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/classes/element.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/classes/others_and_helpers.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/classes/tab.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/nodriver/quickstart.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" />

<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<title>Overview: module code - nodriver documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?v=135e06be" />
Expand Down
8 changes: 4 additions & 4 deletions docs/_build/html/_modules/nodriver/core/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../../genindex.html" /><link rel="search" title="Search" href="../../../search.html" />

<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<title>nodriver.core.browser - nodriver documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../../_static/styles/furo.css?v=135e06be" />
Expand Down Expand Up @@ -468,7 +468,7 @@ <h1>Source code for nodriver.core.browser</h1><div class="highlight"><pre>
<span class="n">new_target</span> <span class="o">=</span> <span class="n">Tab</span><span class="p">(</span>
<span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;ws://</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">host</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">port</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot;/devtools/</span><span class="si">{</span><span class="n">target_info</span><span class="o">.</span><span class="n">type_</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot;/devtools/page&quot;</span> <span class="c1"># all types are &#39;page&#39; internally in chrome apparently</span>
<span class="sa">f</span><span class="s2">&quot;/</span><span class="si">{</span><span class="n">target_info</span><span class="o">.</span><span class="n">target_id</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="p">),</span>
<span class="n">target</span><span class="o">=</span><span class="n">target_info</span><span class="p">,</span>
Expand Down Expand Up @@ -784,7 +784,7 @@ <h1>Source code for nodriver.core.browser</h1><div class="highlight"><pre>
<span class="n">Connection</span><span class="p">(</span>
<span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;ws://</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">host</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">port</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot;/devtools/</span><span class="si">{</span><span class="n">t</span><span class="o">.</span><span class="n">type_</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="sa">f</span><span class="s2">&quot;/devtools/page&quot;</span> <span class="c1"># all types are &#39;page&#39; somehow</span>
<span class="sa">f</span><span class="s2">&quot;/</span><span class="si">{</span><span class="n">t</span><span class="o">.</span><span class="n">target_id</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="p">),</span>
<span class="n">target</span><span class="o">=</span><span class="n">t</span><span class="p">,</span>
Expand Down Expand Up @@ -1085,7 +1085,7 @@ <h1>Source code for nodriver.core.browser</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">_request</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>

<span class="k">async</span> <span class="k">def</span> <span class="nf">_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endpoint</span><span class="p">,</span> <span class="n">method</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;get&quot;</span><span class="p">,</span> <span class="n">data</span><span class="p">:</span> <span class="nb">dict</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">parse</span><span class="o">.</span><span class="n">urljoin</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">api</span><span class="p">,</span> <span class="s2">&quot;/&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s2">&quot;json&quot;</span><span class="p">,</span> <span class="n">endpoint</span><span class="p">]))</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">parse</span><span class="o">.</span><span class="n">urljoin</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">api</span><span class="p">,</span> <span class="sa">f</span><span class="s2">&quot;json/</span><span class="si">{</span><span class="n">endpoint</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">endpoint</span> <span class="k">else</span> <span class="s2">&quot;/json&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">data</span> <span class="ow">and</span> <span class="n">method</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;get&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;get requests cannot contain data&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">url</span><span class="p">:</span>
Expand Down
33 changes: 32 additions & 1 deletion docs/_build/html/_modules/nodriver/core/element.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../../genindex.html" /><link rel="search" title="Search" href="../../../search.html" />

<!-- Generated with Sphinx 7.2.6 and Furo 2024.01.29 -->
<!-- Generated with Sphinx 7.2.6 and Furo 2023.09.10 -->
<title>nodriver.core.element - nodriver documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../../_static/styles/furo.css?v=135e06be" />
Expand Down Expand Up @@ -493,6 +493,11 @@ <h1>Source code for nodriver.core.element</h1><div class="highlight"><pre>
<div class="viewcode-block" id="Element.save_to_dom">
<a class="viewcode-back" href="../../../nodriver/classes/element.html#nodriver.Element.save_to_dom">[docs]</a>
<span class="k">async</span> <span class="k">def</span> <span class="nf">save_to_dom</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> saves a screenshot of this element only</span>
<span class="sd"> :return:</span>
<span class="sd"> :rtype:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_remote_object</span> <span class="o">=</span> <span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span>
<span class="n">cdp</span><span class="o">.</span><span class="n">dom</span><span class="o">.</span><span class="n">resolve_node</span><span class="p">(</span><span class="n">backend_node_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">backend_node_id</span><span class="p">)</span>
<span class="p">)</span>
Expand Down Expand Up @@ -1188,6 +1193,32 @@ <h1>Source code for nodriver.core.element</h1><div class="highlight"><pre>
<span class="p">)</span></div>


<div class="viewcode-block" id="Element.highlight_overlay">
<a class="viewcode-back" href="../../../nodriver/classes/element.html#nodriver.Element.highlight_overlay">[docs]</a>
<span class="k">async</span> <span class="k">def</span> <span class="nf">highlight_overlay</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> highlights the element devtools-style. To remove the highlight,</span>
<span class="sd"> call the method again.</span>
<span class="sd"> :return:</span>
<span class="sd"> :rtype:</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">&#39;_is_highlighted&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
<span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_highlighted</span>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">cdp</span><span class="o">.</span><span class="n">overlay</span><span class="o">.</span><span class="n">hide_highlight</span><span class="p">())</span>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">cdp</span><span class="o">.</span><span class="n">dom</span><span class="o">.</span><span class="n">disable</span><span class="p">())</span>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">cdp</span><span class="o">.</span><span class="n">overlay</span><span class="o">.</span><span class="n">disable</span><span class="p">())</span>
<span class="k">return</span>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">cdp</span><span class="o">.</span><span class="n">dom</span><span class="o">.</span><span class="n">enable</span><span class="p">())</span>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">cdp</span><span class="o">.</span><span class="n">overlay</span><span class="o">.</span><span class="n">enable</span><span class="p">())</span>
<span class="n">conf</span> <span class="o">=</span> <span class="n">cdp</span><span class="o">.</span><span class="n">overlay</span><span class="o">.</span><span class="n">HighlightConfig</span><span class="p">(</span><span class="n">show_info</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">show_extension_lines</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">show_styles</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">tab</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">cdp</span><span class="o">.</span><span class="n">overlay</span><span class="o">.</span><span class="n">highlight_node</span><span class="p">(</span><span class="n">highlight_config</span><span class="o">=</span><span class="n">conf</span><span class="p">,</span> <span class="n">backend_node_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">backend_node_id</span><span class="p">))</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">&#39;_is_highlighted&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span></div>





<div class="viewcode-block" id="Element.record_video">
<a class="viewcode-back" href="../../../nodriver/classes/element.html#nodriver.Element.record_video">[docs]</a>
<span class="k">async</span> <span class="k">def</span> <span class="nf">record_video</span><span class="p">(</span>
Expand Down
Loading

0 comments on commit 96b8d37

Please sign in to comment.