Skip to content

Commit 3c5a4a0

Browse files
committed
Update the docs
1 parent 1cea697 commit 3c5a4a0

File tree

3 files changed

+95
-187
lines changed

3 files changed

+95
-187
lines changed

examples/cdp_mode/ReadMe/index.html

Lines changed: 40 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -881,70 +881,25 @@
881881
<li class="md-nav__item">
882882
<a href="#cdp-mode-usage" class="md-nav__link">
883883
<span class="md-ellipsis">
884-
🐙 CDP Mode usage
884+
🐙 CDP Mode Usage
885885
</span>
886886
</a>
887887

888888
</li>
889889

890890
<li class="md-nav__item">
891-
<a href="#here-are-some-common-sbcdp-methods" class="md-nav__link">
891+
<a href="#here-are-a-few-common-sbcdp-methods" class="md-nav__link">
892892
<span class="md-ellipsis">
893-
🐙 Here are some common sb.cdp methods
893+
🐙 Here are a few common sb.cdp methods
894894
</span>
895895
</a>
896896

897897
</li>
898898

899899
<li class="md-nav__item">
900-
<a href="#cdp-mode-examples" class="md-nav__link">
900+
<a href="#cdp-mode-examples-seleniumbaseexamplescdp_mode" class="md-nav__link">
901901
<span class="md-ellipsis">
902-
🐙 CDP Mode examples
903-
</span>
904-
</a>
905-
906-
</li>
907-
908-
<li class="md-nav__item">
909-
<a href="#example-1-pokemon-site-using-incapsulaimperva-protection-with-invisible-recaptcha" class="md-nav__link">
910-
<span class="md-ellipsis">
911-
🔖 Example 1: (Pokemon site using Incapsula/Imperva protection with invisible reCAPTCHA)
912-
</span>
913-
</a>
914-
915-
</li>
916-
917-
<li class="md-nav__item">
918-
<a href="#example-2-hyatt-site-using-kasada-protection" class="md-nav__link">
919-
<span class="md-ellipsis">
920-
🔖 Example 2: (Hyatt site using Kasada protection)
921-
</span>
922-
</a>
923-
924-
</li>
925-
926-
<li class="md-nav__item">
927-
<a href="#example-3-bestwestern-site-using-datadome-protection" class="md-nav__link">
928-
<span class="md-ellipsis">
929-
🔖 Example 3: (BestWestern site using DataDome protection)
930-
</span>
931-
</a>
932-
933-
</li>
934-
935-
<li class="md-nav__item">
936-
<a href="#example-4-walmart-site-using-akamai-protection-with-perimeterx" class="md-nav__link">
937-
<span class="md-ellipsis">
938-
🔖 Example 4: (Walmart site using Akamai protection with PerimeterX)
939-
</span>
940-
</a>
941-
942-
</li>
943-
944-
<li class="md-nav__item">
945-
<a href="#example-5-nike-site-using-shape-security" class="md-nav__link">
946-
<span class="md-ellipsis">
947-
🔖 Example 5: (Nike site using Shape Security)
902+
🐙 CDP Mode Examples (SeleniumBase/examples/cdp_mode)
948903
</span>
949904
</a>
950905

@@ -2701,70 +2656,25 @@
27012656
<li class="md-nav__item">
27022657
<a href="#cdp-mode-usage" class="md-nav__link">
27032658
<span class="md-ellipsis">
2704-
🐙 CDP Mode usage
2705-
</span>
2706-
</a>
2707-
2708-
</li>
2709-
2710-
<li class="md-nav__item">
2711-
<a href="#here-are-some-common-sbcdp-methods" class="md-nav__link">
2712-
<span class="md-ellipsis">
2713-
🐙 Here are some common sb.cdp methods
2714-
</span>
2715-
</a>
2716-
2717-
</li>
2718-
2719-
<li class="md-nav__item">
2720-
<a href="#cdp-mode-examples" class="md-nav__link">
2721-
<span class="md-ellipsis">
2722-
🐙 CDP Mode examples
2723-
</span>
2724-
</a>
2725-
2726-
</li>
2727-
2728-
<li class="md-nav__item">
2729-
<a href="#example-1-pokemon-site-using-incapsulaimperva-protection-with-invisible-recaptcha" class="md-nav__link">
2730-
<span class="md-ellipsis">
2731-
🔖 Example 1: (Pokemon site using Incapsula/Imperva protection with invisible reCAPTCHA)
2732-
</span>
2733-
</a>
2734-
2735-
</li>
2736-
2737-
<li class="md-nav__item">
2738-
<a href="#example-2-hyatt-site-using-kasada-protection" class="md-nav__link">
2739-
<span class="md-ellipsis">
2740-
🔖 Example 2: (Hyatt site using Kasada protection)
2741-
</span>
2742-
</a>
2743-
2744-
</li>
2745-
2746-
<li class="md-nav__item">
2747-
<a href="#example-3-bestwestern-site-using-datadome-protection" class="md-nav__link">
2748-
<span class="md-ellipsis">
2749-
🔖 Example 3: (BestWestern site using DataDome protection)
2659+
🐙 CDP Mode Usage
27502660
</span>
27512661
</a>
27522662

27532663
</li>
27542664

27552665
<li class="md-nav__item">
2756-
<a href="#example-4-walmart-site-using-akamai-protection-with-perimeterx" class="md-nav__link">
2666+
<a href="#here-are-a-few-common-sbcdp-methods" class="md-nav__link">
27572667
<span class="md-ellipsis">
2758-
🔖 Example 4: (Walmart site using Akamai protection with PerimeterX)
2668+
🐙 Here are a few common sb.cdp methods
27592669
</span>
27602670
</a>
27612671

27622672
</li>
27632673

27642674
<li class="md-nav__item">
2765-
<a href="#example-5-nike-site-using-shape-security" class="md-nav__link">
2675+
<a href="#cdp-mode-examples-seleniumbaseexamplescdp_mode" class="md-nav__link">
27662676
<span class="md-ellipsis">
2767-
🔖 Example 5: (Nike site using Shape Security)
2677+
🐙 CDP Mode Examples (SeleniumBase/examples/cdp_mode)
27682678
</span>
27692679
</a>
27702680

@@ -2826,27 +2736,29 @@ <h2 id="cdp-mode"><a href="https://github.com/seleniumbase/SeleniumBase/"><img s
28262736
<li>Backwards compatibility for existing UC Mode scripts.</li>
28272737
<li>More configuration options when launching browsers.</li>
28282738
<li>More methods. (And bug-fixes for existing methods.)</li>
2739+
<li><code>PyAutoGUI</code> integration for advanced stealth abilities.</li>
28292740
<li>Faster response time for support. (Eg. <a href="https://discord.gg/EdhQTn3EyE">Discord Chat</a>)</li>
28302741
</ul>
28312742
<hr />
2832-
<h3 id="cdp-mode-usage">🐙 <b translate="no">CDP Mode</b> usage<a class="headerlink" href="#cdp-mode-usage" title="Permanent link">&para;</a></h3>
2743+
<h3 id="cdp-mode-usage">🐙 <b translate="no">CDP Mode</b> Usage<a class="headerlink" href="#cdp-mode-usage" title="Permanent link">&para;</a></h3>
28332744
<ul>
28342745
<li><strong><code>sb.activate_cdp_mode(url)</code></strong></li>
28352746
</ul>
28362747
<blockquote>
28372748
<p>(Call that from a <strong>UC Mode</strong> script)</p>
28382749
</blockquote>
28392750
<p>That disconnects WebDriver from Chrome (which prevents detection), and gives you access to <code>sb.cdp</code> methods (which don't trigger anti-bot checks).</p>
2840-
<h3 id="here-are-some-common-sbcdp-methods">🐙 Here are some common <code>sb.cdp</code> methods<a class="headerlink" href="#here-are-some-common-sbcdp-methods" title="Permanent link">&para;</a></h3>
2751+
<h3 id="here-are-a-few-common-sbcdp-methods">🐙 Here are a few common <code>sb.cdp</code> methods<a class="headerlink" href="#here-are-a-few-common-sbcdp-methods" title="Permanent link">&para;</a></h3>
28412752
<ul>
28422753
<li><code>sb.cdp.click(selector)</code></li>
28432754
<li><code>sb.cdp.click_if_visible(selector)</code></li>
2755+
<li><code>sb.cdp.gui_click_element(selector)</code></li>
28442756
<li><code>sb.cdp.type(selector, text)</code></li>
28452757
<li><code>sb.cdp.press_keys(selector, text)</code></li>
28462758
<li><code>sb.cdp.select_all(selector)</code></li>
28472759
<li><code>sb.cdp.get_text(selector)</code></li>
28482760
</ul>
2849-
<p>When <code>type()</code> is too fast, use the slower <code>press_keys()</code> to avoid detection. You can also use <code>sb.sleep(seconds)</code> to slow things down.</p>
2761+
<p>When <code>type()</code> is too fast, use the slower <code>press_keys()</code> to avoid detection. You can also use <code>sb.sleep(seconds)</code> to slow things down. Methods that start with <code>sb.cdp.gui</code> use <code>PyAutoGUI</code> for interaction.</p>
28502762
<p>To use WebDriver methods again, call:</p>
28512763
<ul>
28522764
<li><strong><code>sb.reconnect()</code></strong> or <strong><code>sb.connect()</code></strong></li>
@@ -2862,17 +2774,12 @@ <h3 id="here-are-some-common-sbcdp-methods">🐙 Here are some common <code>sb.c
28622774
<li><strong><code>sb.is_connected()</code></strong></li>
28632775
</ul>
28642776
<hr />
2865-
<h3 id="cdp-mode-examples">🐙 <b translate="no">CDP Mode</b> examples<a class="headerlink" href="#cdp-mode-examples" title="Permanent link">&para;</a></h3>
2866-
<blockquote>
2867-
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode">SeleniumBase/examples/cdp_mode</a></p>
2868-
</blockquote>
2869-
<h3 id="example-1-pokemon-site-using-incapsulaimperva-protection-with-invisible-recaptcha">🔖 Example 1: (Pokemon site using Incapsula/Imperva protection with invisible reCAPTCHA)<a class="headerlink" href="#example-1-pokemon-site-using-incapsulaimperva-protection-with-invisible-recaptcha" title="Permanent link">&para;</a></h3>
2870-
<blockquote>
2871-
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_pokemon.py">SeleniumBase/examples/cdp_mode/raw_pokemon.py</a></p>
2872-
</blockquote>
2777+
<h3 id="cdp-mode-examples-seleniumbaseexamplescdp_mode">🐙 <b translate="no">CDP Mode</b> Examples (<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode">SeleniumBase/examples/cdp_mode</a>)<a class="headerlink" href="#cdp-mode-examples-seleniumbaseexamplescdp_mode" title="Permanent link">&para;</a></h3>
2778+
<p><div /></p>
2779+
28732780
<div></div>
28742781
<details>
2875-
<summary> ▶️ (<b>Click to expand code preview</b>)</summary>
2782+
<summary> ▶️ 🔖 <b>Example 1: (Pokemon site using Incapsula/Imperva protection with invisible reCAPTCHA)</b></summary>
28762783

28772784
<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>
28782785

@@ -2925,13 +2832,12 @@ <h3 id="example-1-pokemon-site-using-incapsulaimperva-protection-with-invisible-
29252832

29262833
</details>
29272834

2928-
<h3 id="example-2-hyatt-site-using-kasada-protection">🔖 Example 2: (Hyatt site using Kasada protection)<a class="headerlink" href="#example-2-hyatt-site-using-kasada-protection" title="Permanent link">&para;</a></h3>
29292835
<blockquote>
2930-
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_hyatt.py">SeleniumBase/examples/cdp_mode/raw_hyatt.py</a></p>
2836+
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_pokemon.py">SeleniumBase/examples/cdp_mode/raw_pokemon.py</a></p>
29312837
</blockquote>
29322838
<div></div>
29332839
<details>
2934-
<summary> ▶️ (<b>Click to expand code preview</b>)</summary>
2840+
<summary> ▶️ 🔖 <b>Example 2: (Hyatt site using Kasada protection)</b></summary>
29352841

29362842
<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>
29372843

@@ -2971,13 +2877,12 @@ <h3 id="example-2-hyatt-site-using-kasada-protection">🔖 Example 2: (Hyatt sit
29712877

29722878
</details>
29732879

2974-
<h3 id="example-3-bestwestern-site-using-datadome-protection">🔖 Example 3: (BestWestern site using DataDome protection)<a class="headerlink" href="#example-3-bestwestern-site-using-datadome-protection" title="Permanent link">&para;</a></h3>
2975-
<ul>
2976-
<li><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_bestwestern.py">SeleniumBase/examples/cdp_mode/raw_bestwestern.py</a></li>
2977-
</ul>
2880+
<blockquote>
2881+
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_hyatt.py">SeleniumBase/examples/cdp_mode/raw_hyatt.py</a></p>
2882+
</blockquote>
29782883
<div></div>
29792884
<details>
2980-
<summary> ▶️ (<b>Click to expand code preview</b>)</summary>
2885+
<summary> ▶️ 🔖 <b>Example 3: (BestWestern site using DataDome protection)</b></summary>
29812886

29822887
<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>
29832888

@@ -3014,13 +2919,12 @@ <h3 id="example-3-bestwestern-site-using-datadome-protection">🔖 Example 3: (B
30142919

30152920
</details>
30162921

3017-
<h3 id="example-4-walmart-site-using-akamai-protection-with-perimeterx">🔖 Example 4: (Walmart site using Akamai protection with PerimeterX)<a class="headerlink" href="#example-4-walmart-site-using-akamai-protection-with-perimeterx" title="Permanent link">&para;</a></h3>
3018-
<ul>
3019-
<li><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_walmart.py">SeleniumBase/examples/cdp_mode/raw_walmart.py</a></li>
3020-
</ul>
2922+
<blockquote>
2923+
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_bestwestern.py">SeleniumBase/examples/cdp_mode/raw_bestwestern.py</a></p>
2924+
</blockquote>
30212925
<div></div>
30222926
<details>
3023-
<summary> ▶️ (<b>Click to expand code preview</b>)</summary>
2927+
<summary> ▶️ 🔖 <b>Example 4: (Walmart site using Akamai protection with PerimeterX)</b></summary>
30242928

30252929
<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>
30262930

@@ -3059,13 +2963,12 @@ <h3 id="example-4-walmart-site-using-akamai-protection-with-perimeterx">🔖 Exa
30592963

30602964
</details>
30612965

3062-
<h3 id="example-5-nike-site-using-shape-security">🔖 Example 5: (Nike site using Shape Security)<a class="headerlink" href="#example-5-nike-site-using-shape-security" title="Permanent link">&para;</a></h3>
3063-
<ul>
3064-
<li><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_nike.py">SeleniumBase/examples/cdp_mode/raw_nike.py</a></li>
3065-
</ul>
2966+
<blockquote>
2967+
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_walmart.py">SeleniumBase/examples/cdp_mode/raw_walmart.py</a></p>
2968+
</blockquote>
30662969
<div></div>
30672970
<details>
3068-
<summary> ▶️ (<b>Click to expand code preview</b>)</summary>
2971+
<summary> ▶️ 🔖 <b>Example 5: (Nike site using Shape Security)</b></summary>
30692972

30702973
<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>
30712974

@@ -3088,10 +2991,15 @@ <h3 id="example-5-nike-site-using-shape-security">🔖 Example 5: (Nike site usi
30882991

30892992
</details>
30902993

2994+
<blockquote>
2995+
<p><a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/cdp_mode/raw_nike.py">SeleniumBase/examples/cdp_mode/raw_nike.py</a></p>
2996+
</blockquote>
2997+
<p><div /></p>
2998+
30912999
<p>(<b>Note:</b> Extra <code translate="no">sb.sleep()</code> calls have been added to prevent bot-detection because some sites will flag you as a bot if you perform actions too quickly.)</p>
30923000
<p>(<b>Note:</b> Some sites may IP-block you for 36 hours or more if they catch you using regular <span translate="no">Selenium WebDriver</span>. Be extra careful when creating and/or modifying automation scripts that run on them.)</p>
30933001
<hr />
3094-
<h3 id="cdp-mode-api-methods">🐙 CDP Mode API / Methods<a class="headerlink" href="#cdp-mode-api-methods" title="Permanent link">&para;</a></h3>
3002+
<h3 id="cdp-mode-api-methods">🐙 <b translate="no">CDP Mode</b> API / Methods<a class="headerlink" href="#cdp-mode-api-methods" title="Permanent link">&para;</a></h3>
30953003
<p>(Some method args have been left out for simplicity. Eg: <code translate="no">timeout</code>)</p>
30963004
<div class="highlight"><pre><span></span><code><span class="n">sb</span><span class="o">.</span><span class="n">cdp</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
30973005
<span class="n">sb</span><span class="o">.</span><span class="n">cdp</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
@@ -3220,7 +3128,7 @@ <h3 id="cdp-mode-api-methods">🐙 CDP Mode API / Methods<a class="headerlink" h
32203128
<span class="n">sb</span><span class="o">.</span><span class="n">cdp</span><span class="o">.</span><span class="n">save_screenshot</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">folder</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">selector</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
32213129
</code></pre></div>
32223130
<hr />
3223-
<h3 id="cdp-mode-webelement-api-methods">🐙 CDP Mode WebElement API / Methods<a class="headerlink" href="#cdp-mode-webelement-api-methods" title="Permanent link">&para;</a></h3>
3131+
<h3 id="cdp-mode-webelement-api-methods">🐙 <b translate="no">CDP Mode</b> WebElement API / Methods<a class="headerlink" href="#cdp-mode-webelement-api-methods" title="Permanent link">&para;</a></h3>
32243132
<div class="highlight"><pre><span></span><code><span class="n">element</span><span class="o">.</span><span class="n">clear_input</span><span class="p">()</span>
32253133
<span class="n">element</span><span class="o">.</span><span class="n">click</span><span class="p">()</span>
32263134
<span class="n">element</span><span class="o">.</span><span class="n">flash</span><span class="p">(</span><span class="n">duration</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s2">&quot;EE4488&quot;</span><span class="p">)</span>

search/search_index.json

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

0 commit comments

Comments
 (0)