Selenium in Python, Unable to Click 'button': Tag not found
<p><em>TL,DR:</em> </p>

<p>For whatever reason, my selenium python script can't seem to "click" on the buttons I need.</p>

<p><em>Context:</em></p>

<p>Hello. My task is one many are probably familiar with: I'd like to automate the process of opening a website, logging in, and clicking on a few drop-down menu links within the website, which will ultimately lead me to a page where I can download a spreadsheet. I'm able to open the web page and log in. To proceed, I have to: </p>

<ol>
<li>Click on the drop down menu header, and</li>
<li>in the drop down menu, click on the appropriate option.</li>
</ol>

<p>Here's a snapshot of the pertinent HTML code from the website:</p>

<pre><code>&lt;td class="x-toolbar-cell" id="ext-gen45"&gt;
    &lt;table id="ext-comp-1045" class="x-btn x-btn-noicon" style="width: auto;" cellspacing="0"&gt;
        &lt;tbody class="x-btn-small x-btn-icon-small-left"&gt;
            &lt;tr&gt;
                &lt;td class="x-btn-ml"&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/td&gt;
                &lt;td class="x-btn-mc"&gt;
                    &lt;em class="x-btn-arrow" unselectable="on"&gt;
    &lt;button type="button" id="ext-gen46" class=" x-btn-text"&gt;Reports&lt;/button&gt;
&lt;/em&gt;
                &lt;/td&gt;
                &lt;td class="x-btn-mr"&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/tbody&gt;
    &lt;/table&gt;
&lt;/td&gt;
</code></pre>

<p>The item I need to "click" has a <code>button</code> tag, specifically:</p>

<pre><code>&lt;button type="button" id="ext-gen46" class=" x-btn-text"&gt;Reports&lt;/button&gt;
</code></pre>

<p>To select it with selenium, I've tried the following:</p>

<pre><code>reports_click_element = browser.find_element_by_id('ext-gen46').click()
</code></pre>

<p>and when that failed,</p>

<pre><code>reports_element = browser.find_element_by_xpath("//button[contains(text(), 'Reports')]").click()
</code></pre>

<p>That one actually executed without an ExceptionMessage error, but I found out it was selecting other elements in the page that had "Reports" text, as opposed to the particular button I need.</p>

<p>When I've tried to zero in on the button I need clicked, the interpreter returned an error message indicating that the html attributes could not be found. </p>

<p>How can I proceed from here? (Should I be focusing on the <code>unselectable="on"</code> tag in the element right above the button I need clicked?)</p>

<p>Please let me know if I can add anything to the question. Thanks in advance. </p>

<p><strong>Update:</strong>
I <em>have</em> switched into an iframe that I believe the menu is a part of- but I <em>still</em> cannot select the button. So far, here is my Python code:</p>

<pre><code>from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import time

binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
browser = webdriver.Firefox(firefox_binary=binary)

browser.get("https://app.website.com")

login_entry(username, password) # this works fine; it's just a user-created function to login. Ignore.

time.sleep(10) # wait for website's markup to load
browser.switch_to.frame(browser.find_element_by_tag_name("iframe"))
time.sleep(10)

# This is the point where I'm trying to click on the "Reports" button
reports_element = browser.find_element_by_xpath("//*[contains(text(), 'Reports')]") #this refers to other elements
reports_element = browser.find_element_by_xpath("//button[contains(text(), 'Reports')][1]") #no luck here either
</code></pre>