I'm trying to find a search box in some HTML and selenium won't find it.
I've tried the following.
driver.find_element_by_id
driver.find_element_by_class_name
driver.find_element_by_xpath
driver.find_element_by_css_selector
nothing has worked so far.
I've also gone line by line through the HTML and found the point where it stops picking up the elements, and in between the last one it can find and the first one it can't find is a text string as follows. (<> removed because otherwise I can't post it)
iframe id="iframeCenter" src="url initialise=true" width="100%"
onload="resizePortlet()" frameborder="0" height="894"
/iframe
#document
!-- tabbedFindMaintenanceLayout.jsp --
html class="dj_quirks ... "/html etc
The part that says src="URL has been shortened for security reasons, but it was just the url of the web page I have active
The search button is located further down inside this HTML tag but my driver can't get there.
Here is the html of the search box
tr
td class="form_inputBoxTitle"><input type="text" name="search" size="20"
value="" id="form_search"/td
input type="text" name="search" size="20" value="" id="form_search"
/tr
Now for my code :/
finding search box
search_box = driver.find_element_by_class_name('form_inputBoxTitle')
search_box.send_keys(phc)
finding iframe
iFrame = driver.find_element_by_id('iframeCenter')
finding html class
dj = driver.find_element_by_id('dj_quirks ')
iFrame finds the correct html tag as I would expect it to. search_box and dj both return the following error message.
search_box = driver.find_element_by_class_name('form_inputBoxTitle')
File "C:\Users\webdriver.py", line 564, in find_element_by_class_name
return self.find_element(by=By.CLASS_NAME, value=name)
File "C:\Users\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Users\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such
element: Unable to locate element: {"method":"css
selector","selector":".form_inputBoxTitle"}
(Session info: chrome=76.0.3809.132)
What is the issue here?