Skip to content

Commit

Permalink
disabled search engine choice screen (european laws) which blocks the…
Browse files Browse the repository at this point in the history
… entire viewport.
  • Loading branch information
ultrafunkamsterdam committed Aug 10, 2024
1 parent dd5e80a commit 3dc3ec8
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 23 deletions.
1 change: 0 additions & 1 deletion docs/_build/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ <h1>All modules for which code is available</h1>
<li><a href="nodriver/core/_contradict.html">nodriver.core._contradict</a></li>
<li><a href="nodriver/core/browser.html">nodriver.core.browser</a></li>
<li><a href="nodriver/core/config.html">nodriver.core.config</a></li>
<li><a href="nodriver/core/connection.html">nodriver.core.connection</a></li>
<li><a href="nodriver/core/element.html">nodriver.core.element</a></li>
<li><a href="nodriver/core/tab.html">nodriver.core.tab</a></li>
</ul>
Expand Down
4 changes: 0 additions & 4 deletions docs/_build/html/_modules/nodriver/core/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,10 @@ <h1>Source code for nodriver.core.browser</h1><div class="highlight"><pre>
<span class="n">close_fds</span><span class="o">=</span><span class="n">is_posix</span><span class="p">,</span>
<span class="p">)</span>
<span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_process_pid</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_process</span><span class="o">.</span><span class="n">pid</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;created process with pid </span><span class="si">%d</span><span class="s2"> &quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">_process_pid</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_http</span> <span class="o">=</span> <span class="n">HTTPApi</span><span class="p">((</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="p">,</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="p">))</span>

<span class="n">util</span><span class="o">.</span><span class="n">get_registered_instances</span><span class="p">()</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.25</span><span class="p">)</span>
<span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5</span><span class="p">):</span>
<span class="k">try</span><span class="p">:</span>
Expand Down
1 change: 1 addition & 0 deletions docs/_build/html/_modules/nodriver/core/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ <h1>Source code for nodriver.core.config</h1><div class="highlight"><pre>
<span class="s2">&quot;--disable-dev-shm-usage&quot;</span><span class="p">,</span>
<span class="s2">&quot;--disable-features=IsolateOrigins,site-per-process&quot;</span><span class="p">,</span>
<span class="s2">&quot;--disable-session-crashed-bubble&quot;</span><span class="p">,</span>
<span class="s2">&quot;--disable-search-engine-choice-screen&quot;</span><span class="p">,</span>
<span class="p">]</span>

<span class="nd">@property</span>
Expand Down
13 changes: 11 additions & 2 deletions docs/_build/html/_modules/nodriver/core/element.html
Original file line number Diff line number Diff line change
Expand Up @@ -1048,14 +1048,23 @@ <h1>Source code for nodriver.core.element</h1><div class="highlight"><pre>
<div class="viewcode-block" id="Element.select_option">
<a class="viewcode-back" href="../../../nodriver/classes/element.html#nodriver.Element.select_option">[docs]</a>
<span class="k">async</span> <span class="k">def</span> <span class="nf">select_option</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;for form (select) fields. when you have queried the options you can call this method on the option object</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> for form (select) fields. when you have queried the options you can call this method on the option object.</span>
<span class="sd"> 02/08/2024: fixed the problem where events are not fired when programattically selecting an option.</span>

<span class="sd"> calling :func:`option.select_option()` will use that option as selected value.</span>
<span class="sd"> does not work in all cases.</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">node_name</span> <span class="o">==</span> <span class="s2">&quot;OPTION&quot;</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">apply</span><span class="p">(</span><span class="s2">&quot;(o) =&gt; o.selected = true&quot;</span><span class="p">)</span></div>
<span class="k">await</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> (o) =&gt; { </span>
<span class="sd"> o.selected = true ; </span>
<span class="sd"> o.dispatchEvent(new Event(&#39;change&#39;, {view: window,bubbles: true}))</span>
<span class="sd"> }</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="p">)</span></div>


<div class="viewcode-block" id="Element.set_value">
Expand Down
3 changes: 3 additions & 0 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ NODRIVER
##################


`CLICK HERE FOR DOCS <https://ultrafunkamsterdam.github.io/nodriver/>`_
____

**This package provides next level webscraping and browser automation
using a relatively simple interface.**

Expand Down
14 changes: 10 additions & 4 deletions docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@
<article role="main">
<section id="nodriver">
<h1>NODRIVER<a class="headerlink" href="#nodriver" title="Link to this heading">#</a></h1>
<section id="id1">
<h2><a class="reference external" href="https://ultrafunkamsterdam.github.io/nodriver/">CLICK HERE FOR DOCS</a><a class="headerlink" href="#id1" title="Link to this heading">#</a></h2>
<p><strong>This package provides next level webscraping and browser automation
using a relatively simple interface.</strong></p>
<ul class="simple">
Expand All @@ -284,7 +286,7 @@ <h1>NODRIVER<a class="headerlink" href="#nodriver" title="Link to this heading">
to fully customizable everything using the entire array of
<a class="reference external" href="https://chromedevtools.github.io/devtools-protocol/">CDP</a> domains, methods and events available.</p>
<section id="some-features">
<h2>Some features<a class="headerlink" href="#some-features" title="Link to this heading">#</a></h2>
<h3>Some features<a class="headerlink" href="#some-features" title="Link to this heading">#</a></h3>
<ul class="simple">
<li><p>A blazing fast undetected chrome (-ish) automation library</p></li>
<li><p>No chromedriver binary or Selenium dependency</p></li>
Expand All @@ -303,7 +305,7 @@ <h2>Some features<a class="headerlink" href="#some-features" title="Link to this
<li><p>packed with helpers and utility methods for most used and important operations</p></li>
</ul>
<section id="quick-start">
<h3>Quick start<a class="headerlink" href="#quick-start" title="Link to this heading">#</a></h3>
<h4>Quick start<a class="headerlink" href="#quick-start" title="Link to this heading">#</a></h4>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="nodriver/quickstart.html">Quickstart guide</a><ul>
Expand All @@ -318,7 +320,7 @@ <h3>Quick start<a class="headerlink" href="#quick-start" title="Link to this hea
</div>
</section>
<section id="main-objects">
<h3>Main objects<a class="headerlink" href="#main-objects" title="Link to this heading">#</a></h3>
<h4>Main objects<a class="headerlink" href="#main-objects" title="Link to this heading">#</a></h4>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="nodriver/classes/browser.html">Browser class</a><ul>
Expand Down Expand Up @@ -529,7 +531,7 @@ <h3>Main objects<a class="headerlink" href="#main-objects" title="Link to this h
</div>
</section>
<section id="cdp-object">
<h3>CDP object<a class="headerlink" href="#cdp-object" title="Link to this heading">#</a></h3>
<h4>CDP object<a class="headerlink" href="#cdp-object" title="Link to this heading">#</a></h4>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="nodriver/cdp.html">CDP object</a><ul>
Expand Down Expand Up @@ -7159,6 +7161,7 @@ <h3>CDP object<a class="headerlink" href="#cdp-object" title="Link to this headi
</div>
</section>
</section>
</section>
</section>

</article>
Expand Down Expand Up @@ -7207,6 +7210,7 @@ <h3>CDP object<a class="headerlink" href="#cdp-object" title="Link to this headi
<div class="toc-tree">
<ul>
<li><a class="reference internal" href="#">NODRIVER</a><ul>
<li><a class="reference internal" href="#id1">CLICK HERE FOR DOCS</a><ul>
<li><a class="reference internal" href="#some-features">Some features</a><ul>
<li><a class="reference internal" href="#quick-start">Quick start</a></li>
<li><a class="reference internal" href="#main-objects">Main objects</a></li>
Expand All @@ -7215,6 +7219,8 @@ <h3>CDP object<a class="headerlink" href="#cdp-object" title="Link to this headi
</li>
</ul>
</li>
</ul>
</li>
</ul>

</div>
Expand Down
3 changes: 2 additions & 1 deletion docs/_build/html/nodriver/classes/element.html
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@
<dl class="py method">
<dt class="sig sig-object py" id="nodriver.Element.select_option">
<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">select_option</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/nodriver/core/element.html#Element.select_option"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nodriver.Element.select_option" title="Link to this definition">#</a></dt>
<dd><p>for form (select) fields. when you have queried the options you can call this method on the option object</p>
<dd><p>for form (select) fields. when you have queried the options you can call this method on the option object.
02/08/2024: fixed the problem where events are not fired when programattically selecting an option.</p>
<p>calling <code class="xref py py-func docutils literal notranslate"><span class="pre">option.select_option()</span></code> will use that option as selected value.
does not work in all cases.</p>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/searchindex.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions docs/_build/markdown/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NODRIVER

## [CLICK HERE FOR DOCS](https://ultrafunkamsterdam.github.io/nodriver/)

**This package provides next level webscraping and browser automation
using a relatively simple interface.**

Expand All @@ -22,7 +24,7 @@ While usability and convenience is important. It’s also easy
to fully customizable everything using the entire array of
[CDP](https://chromedevtools.github.io/devtools-protocol/) domains, methods and events available.

## Some features
### Some features

* A blazing fast undetected chrome (-ish) automation library
* No chromedriver binary or Selenium dependency
Expand Down Expand Up @@ -59,7 +61,7 @@ to fully customizable everything using the entire array of
* ```first_submit_button = await tab.select(selector='button[type=submit]')```
* ```inputs_in_form = await tab.select_all('form input')``` -->

### Quick start
#### Quick start

* [Quickstart guide](nodriver/quickstart.md)
* [Installation](nodriver/quickstart.md#installation)
Expand All @@ -68,7 +70,7 @@ to fully customizable everything using the entire array of
* [Custom starting options](nodriver/quickstart.md#custom-starting-options)
* [Alternative custom options](nodriver/quickstart.md#alternative-custom-options)

### Main objects
#### Main objects

* [Browser class](nodriver/classes/browser.md)
* [cookies](nodriver/classes/browser.md#cookies)
Expand Down Expand Up @@ -247,7 +249,7 @@ to fully customizable everything using the entire array of
* [`ContraDict.update()`](nodriver/classes/others_and_helpers.md#id10)
* [`ContraDict.values()`](nodriver/classes/others_and_helpers.md#id11)

### CDP object
#### CDP object

* [CDP object](nodriver/cdp.md)
* [Accessibility](nodriver/cdp/accessibility.md)
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ NODRIVER
##################


`CLICK HERE FOR DOCS <https://ultrafunkamsterdam.github.io/nodriver/>`_
____

**This package provides next level webscraping and browser automation
using a relatively simple interface.**

Expand Down
4 changes: 0 additions & 4 deletions nodriver/core/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,10 @@ async def start(self=None) -> Browser:
close_fds=is_posix,
)
)

self._process_pid = self._process.pid
logger.info("created process with pid %d " % self._process_pid)

self._http = HTTPApi((self.config.host, self.config.port))

util.get_registered_instances().add(self)

await asyncio.sleep(0.25)
for _ in range(5):
try:
Expand Down
3 changes: 2 additions & 1 deletion nodriver/core/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ async def select_option(self):
o.selected = true ;
o.dispatchEvent(new Event('change', {view: window,bubbles: true}))
}
""")
"""
)

async def set_value(self, value):
await self._tab.send(cdp.dom.set_node_value(node_id=self.node_id, value=value))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]

name = "nodriver" # Required
version = "0.34" # Required
version = "0.35" # Required

description = """
Expand Down

0 comments on commit 3dc3ec8

Please sign in to comment.