| || |
css/xpath to click on the submit button
I am learning selenium webdriver from the video u have posted and trying to click on the submit button , but the button does not have a id. I don't know how to click on this button now, please help me.
form id="loginForm" action="/xyz/j_spring_security_check" method="POST" autocomplete="off">
Enter your user name and password
<input name="j_username" id="username" tabindex="1" type="text">
<input name="j_password" id="password" tabindex="2" type="password">
<input name="_action_Sign In" value="Sign In" class="submitbutton right" tabindex="3" type="submit">
<div class="clear"> </div>
when i inspect the button, i see the above, can you please help to finish this code
what shd i put in the cssSelector, so that the button is clicked?
Usually for most form elements, using By.Name is generally perferred since those are the same field values the backend uses to parse out the data.
CSS selectors are useful for elements that don't have unique properties. Here's a good article on how to use CSS selectors.
Selenium Tips: CSS Selectors in Selenium Demystified | Selenium Testing? Do Cross Browser Testing with Sauce Labs
the FireFox Add-on FireBug (https://getfirebug.com/) is very helpfull for getting xpath or css locators.