Selenium - Difficulty finding input element on page (Python)
<p>I am having trouble finding a search bar on a webpage that I am trying to automate. I have tried a couple approaches but being rather new to selenium, I am not sure what more advanced locating options there are.</p>

<p>Breakdown::
The following is an section of code with the search bar element (corresponding to input) being highlighted</p>

<p><a href="https://i.stack.imgur.com/Zsu6g.png" rel="nofollow">The xpath to the following highlighted section is below</a>:</p>

<pre><code>//*[@id='core-content-container']/div/div[2]/div/div[1]/nav/div/div[2]/form/ul/li[1]/input
</code></pre>

<p>When I try to find this element via find_element_by_xpath however, I get a <code>NoSuchElementException</code> (I have tried shorter xpaths but those provided the same error)</p>

<p>Below is the relevant code bit I am using to try to find this element:</p>

<pre><code>from selenium import webdriver

driver = webdriver.Firefox()

#DNSMgr
driver.get('https://barista.cac.washington.edu/dnsmgr/#/fqdn')

driver.find_element_by_xpath("//div[@id='core-content-container']/div/div[2]/div/div[1]/nav/div/div[2]/form/ul/li[1]/input")
</code></pre>

<p>Since the exact line that I am trying to get at looks like this:</p>

<pre><code>&lt;input type="text" class="form-control ng-pristine ng-untouched ng-valid" ng-model="query" placeholder="Full domain name"&gt;
</code></pre>

<p>I then thought that maybe I could get at the element by using</p>

<pre><code>driver.find_element_by_css_selector('input.form-control.ng-pristine.ng-untouched.ng-valid')
</code></pre>

<p>Since this is similar to the example on seleniums python tutorials in section 4.7 I thought that could do the job but that also doesn't work (I get another <code>NoSuchElementException</code>).</p>

<p>try with  <code>driver.page_source</code> and then use beautifulSoup to find the element.</p>

python selenium