Python Forum
Unable to locate element no such element
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to locate element no such element
#3
(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.
Reply


Messages In This Thread
RE: Unable to locate element no such element - by gahhon - Feb-14-2019, 11:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter only storing last element/data from entry widget bertschj1 8 397 Yesterday, 11:54 PM
Last Post: deanhystad
  I have created a bot in python but getting issue in element selection domic33 0 477 Mar-16-2025, 01:55 PM
Last Post: domic33
  removing one list element without using its index paul18fr 7 1,277 Feb-22-2025, 07:59 PM
Last Post: DeaD_EyE
  question about changing the string value of a list element jacksfrustration 4 2,203 Feb-08-2025, 07:43 AM
Last Post: jacksfrustration
  extract an element of a list into a string alexs 5 3,993 Aug-30-2024, 09:24 PM
Last Post: alexs
  Fixture not returning webdriver element Nik1811 1 1,556 Apr-15-2024, 04:39 PM
Last Post: Nik1811
  element in list detection problem jacksfrustration 5 1,930 Apr-11-2024, 05:44 PM
Last Post: deanhystad
  Elegant way to apply each element of an array to a dataframe? sawtooth500 7 2,854 Mar-29-2024, 05:51 PM
Last Post: deanhystad
  If a set element has digits in the element tester_V 3 1,204 Mar-25-2024, 04:43 PM
Last Post: deanhystad
  Variable for the value element in the index function?? Learner1 8 3,058 Jan-20-2024, 09:20 PM
Last Post: Learner1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020