capmonster_python | Capmonster.cloud library for Python3 | Build Tool library
kandi X-RAY | capmonster_python Summary
kandi X-RAY | capmonster_python Summary
Capmonster.cloud library for Python3
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of capmonster_python
capmonster_python Key Features
capmonster_python Examples and Code Snippets
Community Discussions
Trending Discussions on capmonster_python
QUESTION
I've already tried in several ways to click this checkbox with selenium and I couldn't. Link: http://buscatextual.cnpq.br/buscatextual/email.do?metodo=apresentar&seqIdPessoa=246740&nomeDestinatario=Maria_Jos%E9_Panichi_Vieira I already tried with XPATH, with CLASS_NAME and others, but the return is always the same:
...ANSWER
Answered 2022-Feb-01 at 18:25The ReCaptcha checkbox is within an </code></a> so you have to:</p>
<ul>
<li>Induce <a href="https://stackoverflow.com/questions/59130200/selenium-wait-until-element-is-present-visible-and-interactable/59130336#59130336">WebDriverWait</a> for the desired <em>frame to be available and switch to it</em>.</li>
<li>Induce <a href="https://stackoverflow.com/questions/52603847/how-to-sleep-webdriver-in-python-for-milliseconds/52607451#52607451">WebDriverWait</a> for the desired <em>element to be clickable</em>.</li>
<li>You can use either of the following <a href="https://stackoverflow.com/questions/48369043/official-locator-strategies-for-the-webdriver/48376890#48376890">Locator Strategies</a>:
<ul>
<li><p>Using <em>CSS_SELECTOR</em>:</p>
<pre><code>driver.get('http://buscatextual.cnpq.br/buscatextual/email.do?metodo=apresentar&seqIdPessoa=246740&nomeDestinatario=Maria_Jos%E9_Panichi_Vieira')
WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[title='reCAPTCHA']")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.recaptcha-checkbox-border"))).click()
</code></pre>
</li>
<li><p>Using <em>XPATH</em>:</p>
<pre><code>driver.get('http://buscatextual.cnpq.br/buscatextual/email.do?metodo=apresentar&seqIdPessoa=246740&nomeDestinatario=Maria_Jos%E9_Panichi_Vieira')
WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,"//iframe[@title='reCAPTCHA']")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.recaptcha-checkbox-border"))).click()
</code></pre>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>PS: Clicking on the <a href="https://stackoverflow.com/a/58876531/7429447"><strong>ReCaptcha</strong></a> checkbox opens the image selection panel.</p>
</blockquote>
<ul>
<li><p><strong>Note</strong> : You have to add the following imports :</p>
<pre><code>from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
</code></pre>
</li>
<li><p>Browser Snapshot:</p>
</li>
</ul>
<p><img src="https://i.stack.imgur.com/jNXJA.png" alt="click_captcha" /></p>
<hr />
<h2>Reference</h2>
<p>You can find a couple of relevant discussions in:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/44834358/switch-to-an-iframe-through-selenium-and-python/44847390#44847390">Switch to an iframe through Selenium and python</a></li>
<li><a href="https://stackoverflow.com/questions/50315587/selenium-common-exceptions-nosuchelementexception-message-no-such-element-una/50315715#50315715">selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium</a></li>
<li><a href="https://stackoverflow.com/questions/53441658/selenium-in-python-nosuchelementexception-message-no-such-element-unable-to/53442511#53442511">selenium in python : NoSuchElementException: Message: no such element: Unable to locate element</a></li>
</ul>
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install capmonster_python
You can use capmonster_python like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page