Skip to content

Commit d3cff00

Browse files
committed
Update the docs
1 parent 3782e96 commit d3cff00

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

help_docs/uc_mode/index.html

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,12 +2715,12 @@ <h2 id="uc-mode"><a href="https://github.com/seleniumbase/SeleniumBase/"><img sr
27152715
<span class="n">url</span> <span class="o">=</span> <span class="s2">&quot;https://ahrefs.com/website-authority-checker&quot;</span>
27162716
<span class="n">input_field</span> <span class="o">=</span> <span class="s1">&#39;input[placeholder=&quot;Enter domain&quot;]&#39;</span>
27172717
<span class="n">submit_button</span> <span class="o">=</span> <span class="s1">&#39;span:contains(&quot;Check Authority&quot;)&#39;</span>
2718-
<span class="n">sb</span><span class="o">.</span><span class="n">uc_open_with_reconnect</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="c1"># The bot-check is later</span>
2718+
<span class="n">sb</span><span class="o">.</span><span class="n">uc_open_with_reconnect</span><span class="p">(</span><span class="n">url</span><span class="p">)</span> <span class="c1"># The bot-check is later</span>
27192719
<span class="n">sb</span><span class="o">.</span><span class="n">type</span><span class="p">(</span><span class="n">input_field</span><span class="p">,</span> <span class="s2">&quot;github.com/seleniumbase/SeleniumBase&quot;</span><span class="p">)</span>
27202720
<span class="n">sb</span><span class="o">.</span><span class="n">reconnect</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
27212721
<span class="n">sb</span><span class="o">.</span><span class="n">uc_click</span><span class="p">(</span><span class="n">submit_button</span><span class="p">,</span> <span class="n">reconnect_time</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span>
27222722
<span class="n">sb</span><span class="o">.</span><span class="n">uc_gui_click_captcha</span><span class="p">()</span>
2723-
<span class="n">sb</span><span class="o">.</span><span class="n">wait_for_text_not_visible</span><span class="p">(</span><span class="s2">&quot;Checking&quot;</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
2723+
<span class="n">sb</span><span class="o">.</span><span class="n">wait_for_text_not_visible</span><span class="p">(</span><span class="s2">&quot;Checking&quot;</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="mi">12</span><span class="p">)</span>
27242724
<span class="n">sb</span><span class="o">.</span><span class="n">highlight</span><span class="p">(</span><span class="s1">&#39;p:contains(&quot;github.com/seleniumbase/SeleniumBase&quot;)&#39;</span><span class="p">)</span>
27252725
<span class="n">sb</span><span class="o">.</span><span class="n">highlight</span><span class="p">(</span><span class="s1">&#39;a:contains(&quot;Top 100 backlinks&quot;)&#39;</span><span class="p">)</span>
27262726
<span class="n">sb</span><span class="o">.</span><span class="n">set_messenger_theme</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="s2">&quot;bottom_center&quot;</span><span class="p">)</span>
@@ -2761,9 +2761,24 @@ <h3 id="here-are-some-examples-that-use-uc-mode">👤 Here are some examples tha
27612761
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/verify_undetected.py">SeleniumBase/examples/verify_undetected.py</a></li>
27622762
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_bing_captcha.py">SeleniumBase/examples/raw_bing_captcha.py</a></li>
27632763
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_uc_mode.py">SeleniumBase/examples/raw_uc_mode.py</a></li>
2764+
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_cf.py">SeleniumBase/examples/raw_cf.py</a></li>
2765+
</ul>
2766+
<hr />
2767+
<p>👤 Here's an example where <strong><code>incognito=True</code> is needed for bypassing detection</strong>:</p>
2768+
<ul>
27642769
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_pixelscan.py">SeleniumBase/examples/raw_pixelscan.py</a></li>
27652770
</ul>
2771+
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">seleniumbase</span> <span class="kn">import</span> <span class="n">SB</span>
2772+
2773+
<span class="k">with</span> <span class="n">SB</span><span class="p">(</span><span class="n">uc</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">incognito</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">test</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">as</span> <span class="n">sb</span><span class="p">:</span>
2774+
<span class="n">sb</span><span class="o">.</span><span class="n">driver</span><span class="o">.</span><span class="n">uc_open_with_reconnect</span><span class="p">(</span><span class="s2">&quot;https://pixelscan.net/&quot;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
2775+
<span class="n">sb</span><span class="o">.</span><span class="n">remove_elements</span><span class="p">(</span><span class="s2">&quot;jdiv&quot;</span><span class="p">)</span> <span class="c1"># Remove chat widgets</span>
2776+
<span class="n">sb</span><span class="o">.</span><span class="n">highlight</span><span class="p">(</span><span class="s2">&quot;span.text-success&quot;</span><span class="p">,</span> <span class="n">loops</span><span class="o">=</span><span class="mi">8</span><span class="p">)</span>
2777+
<span class="n">sb</span><span class="o">.</span><span class="n">highlight</span><span class="p">(</span><span class="s2">&quot;.bot-detection-context&quot;</span><span class="p">,</span> <span class="n">loops</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">scroll</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
2778+
<span class="n">sb</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
2779+
</code></pre></div>
27662780
<p><img src="https://seleniumbase.github.io/other/pixelscan.jpg" title="SeleniumBase" width="540"></p>
2781+
<hr />
27672782
<h3 id="here-are-some-uc-mode-examples-that-bypass-captchas-when-clicking-is-required">👤 Here are some UC Mode examples that bypass CAPTCHAs when clicking is required<a class="headerlink" href="#here-are-some-uc-mode-examples-that-bypass-captchas-when-clicking-is-required" title="Permanent link">&para;</a></h3>
27682783
<ul>
27692784
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_pyautogui.py">SeleniumBase/examples/raw_pyautogui.py</a></li>
@@ -2772,6 +2787,7 @@ <h3 id="here-are-some-uc-mode-examples-that-bypass-captchas-when-clicking-is-req
27722787
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/uc_cdp_events.py">SeleniumBase/examples/uc_cdp_events.py</a></li>
27732788
</ul>
27742789
<p><img src="https://seleniumbase.github.io/other/cf_bypass.png" title="SeleniumBase" width="260"></p>
2790+
<hr />
27752791
<h3 id="here-are-the-driver-specific-methods-added-by-seleniumbase-for-uc-mode-uc-uctrue">👤 Here are the <b><code translate="no">driver</code></b>-specific methods added by SeleniumBase for UC Mode: <code>--uc</code> / <b><code translate="no">uc=True</code></b><a class="headerlink" href="#here-are-the-driver-specific-methods-added-by-seleniumbase-for-uc-mode-uc-uctrue" title="Permanent link">&para;</a></h3>
27762792
<div class="highlight"><pre><span></span><code><span class="n">driver</span><span class="o">.</span><span class="n">uc_open</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
27772793

@@ -2828,17 +2844,20 @@ <h3 id="here-are-the-driver-specific-methods-added-by-seleniumbase-for-uc-mode-u
28282844
<span class="n">driver</span><span class="o">.</span><span class="n">reconnect</span><span class="p">(</span><span class="s2">&quot;breakpoint&quot;</span><span class="p">)</span>
28292845
</code></pre></div>
28302846
<p>(Note that while the special <b><code translate="no">UC Mode</code></b> breakpoint is active, you can't use <b><code translate="no">Selenium</code></b> commands in the browser, and the browser can't detect <b><code translate="no">Selenium</code></b>.)</p>
2847+
<hr />
28312848
<p>👤 On Linux, you may need to use <code>uc_gui_click_captcha()</code> to successfully bypass a Cloudflare CAPTCHA. If there's more than one Cloudflare iframe on that website, then put the CSS Selector of an element that's above the iframe as the first arg to <code>uc_gui_click_captcha()</code>. This method uses <code>pyautogui</code>. In order for <code>pyautogui</code> to focus on the correct element, use <code>xvfb=True</code> / <code>--xvfb</code> to activate a special virtual display on Linux.</p>
28322849
<p>👤 <code>uc_gui_click_captcha()</code> auto-detects the CAPTCHA type before trying to click it. This is a generic method for both CF Turnstile and Google reCAPTCHA. It will use the code from <code>uc_gui_click_cf()</code> and <code>uc_gui_click_rc()</code> as needed.</p>
28332850
<p>👤 <code>uc_gui_click_cf(frame="iframe", retry=False, blind=False)</code> has three args. (All optional). The first one, <code>frame</code>, lets you specify the selector above the iframe in case the CAPTCHA is not located in the first iframe on the page. The second one, <code>retry</code>, lets you retry the click after reloading the page if the first one didn't work (and a CAPTCHA is still present after the page reload). The third arg, <code>blind</code>, (if <code>True</code>), will retry after a page reload (if the first click failed) by clicking at the last known coordinates of the CAPTCHA checkbox without confirming first with Selenium that a CAPTCHA is still on the page.</p>
28342851
<p>👤 <code>uc_gui_click_rc(frame="iframe", retry=False, blind=False)</code> is for reCAPTCHA. This may only work a few times before not working anymore... not because Selenium was detected, but because reCAPTCHA uses advanced AI to detect unusual activity, unlike the CF Turnstile, which only uses basic detection.</p>
2852+
<hr />
28352853
<p>👤 To find out if <b translate="no">UC Mode</b> will work at all on a specific site (before adjusting for timing), load your site with the following script:</p>
28362854
<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">seleniumbase</span> <span class="kn">import</span> <span class="n">SB</span>
28372855

28382856
<span class="k">with</span> <span class="n">SB</span><span class="p">(</span><span class="n">uc</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">as</span> <span class="n">sb</span><span class="p">:</span>
28392857
<span class="n">sb</span><span class="o">.</span><span class="n">uc_open_with_reconnect</span><span class="p">(</span><span class="n">URL</span><span class="p">,</span> <span class="n">reconnect_time</span><span class="o">=</span><span class="s2">&quot;breakpoint&quot;</span><span class="p">)</span>
28402858
</code></pre></div>
28412859
<p>(If you remain undetected while loading the page and performing manual actions, then you know you can create a working script once you swap the breakpoint with a time and add special methods like <b><code translate="no">sb.uc_click</code></b> as needed.)</p>
2860+
<hr />
28422861
<p>👤 <b>Multithreaded UC Mode:</b></p>
28432862
<p>If you're using <b><code translate="no">pytest</code></b> for multithreaded <b translate="no">UC Mode</b> (which requires using one of the <b><code translate="no">pytest</code></b> <a href="../syntax_formats/">syntax formats</a>), then all you have to do is set the number of threads when your script runs. (<code>-n NUM</code>) Eg:</p>
28442863
<div class="highlight"><pre><span></span><code>pytest<span class="w"> </span>--uc<span class="w"> </span>-n<span class="w"> </span><span class="m">4</span>
@@ -2898,7 +2917,7 @@ <h3 id="here-are-the-driver-specific-methods-added-by-seleniumbase-for-uc-mode-u
28982917
<hr />
28992918
<p>🏆 <b>Choosing the right CAPTCHA service</b> for your business / website:</p>
29002919
<p><img src="https://seleniumbase.github.io/other/me_se_conf.jpg" title="SeleniumBase" width="370"></p>
2901-
<p>As an ethical hacker / cybersecurity researcher who builds bots that bypass CAPTCHAs for sport, <b>the CAPTCHA service that I personally recommend</b> for keeping bots out is <b translate="no">Google's reCAPTCHA</b>:</p>
2920+
<p>As an ethical hacker / cybersecurity researcher who builds bots that bypass CAPTCHAs for sport, <b>the CAPTCHA service that I personally recommend</b> for keeping bots out is <b translate="no">Google reCAPTCHA</b>:</p>
29022921
<p><img src="https://seleniumbase.github.io/other/g_recaptcha.png" title="SeleniumBase" width="315"></p>
29032922
<p>Since Google makes Chrome, Google's own <b translate="no">reCAPTCHA</b> service has access to more data than other CAPTCHA services (eg. hCaptcha, CloudFlare, DataDome, etc.), and can therefore use that data to make better decisions about whether or not web activity is coming from real humans or automated bots.</p>
29042923
<hr />

index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2563,10 +2563,12 @@ <h1>SeleniumBase</h1>
25632563
<br />
25642564
</p>
25652565

2566+
<p>SeleniumBase is the professional toolkit for web automation activities. Built for testing websites, bypassing CAPTCHAs, enhancing productivity, completing tasks, and scaling your business.</p>
2567+
25662568
<hr />
25672569
<p>📚 Learn from <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples"><strong>over 200 examples</strong> in the <strong>SeleniumBase/examples/</strong> folder</a>.</p>
25682570
<p>👤 Note that <span translate="no">SeleniumBase</span> <a translate="no" href="help_docs/uc_mode/"><b>UC Mode</b> (Stealth Mode) has its own ReadMe</a>.</p>
2569-
<p>ℹ️ Scripts can be called via <code translate="no"><b>python</b></code>, although some <a href="help_docs/syntax_formats/">Syntax Formats</a> expect <a href="https://docs.pytest.org/en/latest/how-to/usage.html" translate="no"><b>pytest</b></a> (a Python unit-testing framework included with SeleniumBase that can discover &amp; collect tests automatically).</p>
2571+
<p>ℹ️ Scripts can be called via <code translate="no"><b>python</b></code>, although some <a href="help_docs/syntax_formats/">Syntax Formats</a> expect <a href="https://docs.pytest.org/en/latest/how-to/usage.html" translate="no"><b>pytest</b></a> (a Python unit-testing framework included with SeleniumBase that can discover, collect, and run tests automatically).</p>
25702572
<p align="left">📗 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py">my_first_test.py</a>, which tests login, shopping, and checkout:</p>
25712573

25722574
<div class="highlight"><pre><span></span><code>pytest<span class="w"> </span>my_first_test.py

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)