All I'm trying to do is enter a username and password...
I tried:
username=driver.find_element(By.CSS_SELECTOR("UserId"))
username.send_keys("test")
but it gave me the error:
username=driver.find_element(By.CSS_SELECTOR("UserId"))
TypeError: 'str' object is not callable
I just copy and pasted the source for the form below.
<form name="loginform" id="loginform" method='POST' action="login.jsp" AUTOCOMPLETE="off">
<table class="loginmiddletable" cellspacing=8 cellpadding=2>
<tr>
<td style="padding-top:20px" class="loginlabel">Network ID
<INPUT type="text" class="logininput" value='' name="UserId" >
</td>
</tr>
<tr>
<td class="loginlabel">Password
<INPUT type=password class="logininput" value='' name="Password" >
</td>
</tr>
<tr>
<td align="right" class="errormsgstyle">
<input class=loginbutton type=submit name="btnLogin" value='Sign In' title="Click To Sign In" onclick="window.status='Signing in. Please wait...';">
</td>
</tr>
<tr>
<td align="left" class="errormsgstyle">
</td>
</tr>
</table>
</form>
If you want to select by css selector, you'll have to use the correct css selector. You'll want something like this:
The method
find_element
requires 2 arguments:You could also use
find_element_by_name