<p>要单击文本为<strong>Join</strong>的元素,可以使用以下任一<a href="https://stackoverflow.com/questions/48369043/official-locator-strategies-for-the-webdriver/48376890#48376890">Locator Strategies</a>:</p>
<ul>
<li><p>使用部分链接文本:</p>
<pre><code>driver.find_element_by_partial_link_text("Join").click()
</code></pre>
</li>
<li><p>使用xpath<em>eem>:</p>
<pre><code>driver.find_element_by_xpath("//a[contains(., 'Join')]").click()
</code></pre>
</li>
</ul>
<p>理想情况下,要单击元素,需要为<code>element_to_be_clickable()</code>诱导<a href="https://stackoverflow.com/questions/49775502/webdriverwait-not-working-as-expected/49775808#49775808">WebDriverWait</a>,并且可以使用以下<a href="https://stackoverflow.com/questions/48369043/official-locator-strategies-for-the-webdriver/48376890#48376890">Locator Strategies</a>之一:</p>
<ul>
<li><p>使用部分链接文本:</p>
<pre><code>WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, "Join"))).click()
</code></pre>
</li>
<li><p>使用XPATH<em>eem>:</p>
<pre><code>WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(., 'Join')]"))).click()
</code></pre>
</li>
<li><p><strong>注意</strong>:您必须添加以下导入:</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>
</ul>