I am trying to select a text field and enter text into it through the selenium web driver. The html is as follows:
</div><div> <input name="mLayout$ctl00$ctl00$6$16$ctl00$Database" type="text" value="Enter database name" maxlength="175" size="26" id="mLayout_ctl00_ctl00_6_16_ctl00_Database" accesskey="s" title="Go search this database" class="InputContent GhostText" onfocus="SearchBoxOnFocus('mLayout_ctl00_ctl00_6_16_ctl00_Database');" onkeypress="if(!__TextBoxOnKeyPress('mLayout$ctl00$ctl00$6$16$ctl00$GoButton',event.which)) { return false; }" /> <input type="image" name="mLayout$ctl00$ctl00$6$16$ctl00$GoButton" id="mLayout_ctl00_ctl00_6_16_ctl00_GoButton" title="Go search database" src="http://images-statcont.westlaw.com/images/go_v602.gif" alt="Go search database" align="absmiddle" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("mLayout$ctl00$ctl00$6$16$ctl00$GoButton", "", true, "", "", false, false))" style="height:18px;width:21px;border-width:0px;" /> </div><div>
I tried the following
driver.find_element_by_id("mLayout_ctl00_ctl00_6_16_ctl00_Database") driver.find_element_by_name("mLayout$ctl00$ctl00$6$16$ctl00$Database") dbElement = WebDriverWait(driver, 20).until(lambda x : x.find_element_by_id("mLayout_ctl00_ctl00_6_16_ctl00_Database"))
Is there anything special about the $ and _ characters, are these fields? Why can't selenium find these elements?
source share