(Feb-14-2019, 08:13 PM)mlieqo Wrote: Can you post a little bit more of your html ? or at least so that we can verify your xpath is correct? I can't see element with id 'LoginId' for example.
Yeah and also your traceback says you are using xpath method but in your code sample you are trying to find element by name?
driver.find_element_by_name('//*[@id="LoginId"]/table/tbody/tr[3]/td/div/input[1]').send_keys("username1")should be
driver.find_element_by_xpath('//*[@id="LoginId"]/table/tbody/tr[3]/td/div/input[1]').send_keys("username1")
<form class="login-form" name="LoginForm" id="LoginId" action="/eaijct/cnpy" method="post" onsubmit=" return doSubmit_CNPY();"> <table width="100%"> <tbody><tr> <td width="45%" valign="bottom"> <h3 class="form-title" id="login-title">Login to PBe</h3> </td> </tr> <tr> <td align="right" valign="bottom" style="padding-right:20px"> <p class="form-title"> Friday, 15 February 2019 06:58:05 </p> </td> </tr> <!--div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> <span>Enter any user id and password.</span> <div class="form-group"> <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that...--> <tr><td> <div class="input-icon"> <i class="fa fa-user"></i> <script type="text/javascript"> if (getQueryStringParameter("Back") == 1) { document.write("<input class='form-control placeholder-no-fix' type='text' autocomplete='off' placeholder='User ID' name='tempusername' id='username' autocomplete='off' size='14' maxlength='12' value='' /> <input type='hidden' name='username'>"); } else { document.write("<input class='form-control placeholder-no-fix' type='text' autocomplete='off' placeholder='User ID' name='tempusername' autocomplete='off' size='14' maxlength='12' value='' /><input type='hidden' name='username'>"); } </script><input class="form-control placeholder-no-fix" type="text" autocomplete="off" placeholder="User ID" name="tempusername" size="14" maxlength="12" value=""><input type="hidden" name="username"> </div> </td></tr> </tbody></table> </form>Sorry. Was copy wrong, it should get element by xpath.