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.
Breakdown:: The following is an section of code with the search bar element (corresponding to input) being highlighted
The xpath to the following highlighted section is below:
//*[@id='core-content-container']/div/div[2]/div/div[1]/nav/div/div[2]/form/ul/li[1]/input
When I try to find this element via find_element_by_xpath however, I get a NoSuchElementException (I have tried shorter xpaths but those provided the same error)
Below is the relevant code bit I am using to try to find this element:
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")
Since the exact line that I am trying to get at looks like this:
<input type="text" class="form-control ng-pristine ng-untouched ng-valid" ng-model="query" placeholder="Full domain name">
I then thought that maybe I could get at the element by using
driver.find_element_by_css_selector('input.form-control.ng-pristine.ng-untouched.ng-valid')
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 NoSuchElementException).