java - Using xpath to locate an element and click on it -


using selenium java, can not click on button. how use xpath locate element , click on it?

here part of source page using:

<div id="top-navigation"> <ul class="menu"> <li class="item first active"> <a href="/index.php/sprachen-lernen/englisch">home</a></li> <li class="item "> <a href="/index.php/openarea/school">online language school                 </a></li> <li class="item "> <a href="/index.php/openarea/partner">enterprise solutions                 </a></li> <li class="item "> <a href="/index.php/openarea/customer">references                 </a></li> <li class="item last "> <a href="/index.php/openarea/contact">contact</a></li> </ul>     <div id="login-button">                     <a href="/login/login"><img src="/images/openarea/login.png" alt="login" /></a>             </div> </div> 

here statement using

driver.findelement(by.id("login-button")).click(); 

but not click on button.this first effort selenium can please guide me wrong statement or if want use xpath should exact statement

i have used firebug locate xpath of element , works :)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -