Selenium Compound class names not permitted
<p>I have the below code that clicks on an element to pop up a screen and copy the text in it</p>
<pre><code>el1 = driver.find_element_by_id(&quot;keyDev-A&quot;)
el1.click()
el2 = driver.find_element_by_class_name(&quot;content&quot;)
print(el2.text)
</code></pre>
<p>However, when I tried to get <code>selenium</code> to click on the button within that popup with</p>
<pre><code>el3 = driver.find_element(By.CLASS_NAME, &quot;action-btn cancel alert-display&quot;)
el3.click()
</code></pre>
<p>It produces an error message:</p>
<pre><code>invalid selector: Compound class names not permitted
</code></pre>
<p>This is the HTML that I am trying to get <code>selenium</code> to click on. The <code>Close</code> button.</p>
<pre><code>&lt;div class=&quot;nav&quot;&gt;
    &lt;span class=&quot;action-btn confirm prompt-display&quot;&gt;Confirm&lt;/span&gt;
    &lt;span class=&quot;action-btn cancel prompt-display&quot;&gt;Cancel&lt;/span&gt;
    &lt;span class=&quot;action-btn cancel alert-display&quot;&gt;Close&lt;/span&gt;
&lt;/div&gt;
</code></pre>
<p>How should I be writing <code>el3</code> in order to click on the <strong>Close</strong> button?</p>