how to construct the xpath for the submit button....

2,067 views
Skip to first unread message

Rashmi Rohit

unread,
Aug 15, 2012, 12:01:05 AM8/15/12
to seleniu...@googlegroups.com
Need to find the 

<div id="ztsContainer">
<h1>Editing user</h1>
<form method="post" action="/users/51/update/" name="user_form">
<div class="actions">
<input class="btn primary" type="submit" value="Submit">
</div>
</form>
<a href="/users">Back</a>
</div>


Here the Submit is like a button on which I need to click. How do I construct the xPath for this ? Both the below options didnt click on the button- "Submit"

//driver.findElement(By.className("btn primary")).click();
 // driver.findElement(By.className("actions")).click();

Thanks
Rashmi

Karthik Kulkarni

unread,
Aug 15, 2012, 3:23:11 AM8/15/12
to seleniu...@googlegroups.com
after finding the last web element use . sendKeys(keys.Enter) it will work

Rashmi

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/UOATnX6-ahsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Peter Gale

unread,
Aug 15, 2012, 3:28:55 AM8/15/12
to Selenium Users
Try: driver.findElement(By.XPath("//input[@value='submit'")).click();

You might want to do the "find" and the "click" as separate stages so that you can see exactly which stage your code fails on.


Date: Tue, 14 Aug 2012 21:01:05 -0700
From: rashm...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] how to construct the xpath for the submit button....

Need to find the 

<div id="ztsContainer">
<h1>Editing user</h1>
<form method="post" action="/users/51/update/" name="user_form">
<div class="actions">
<input class="btn primary" type="submit" value="Submit">
</div>
</form>
<a href="/users">Back</a>
</div>


Here the Submit is like a button on which I need to click. How do I construct the xPath for this ? Both the below options didnt click on the button- "Submit"

//driver.findElement(By.className("btn primary")).click();
 // driver.findElement(By.className("actions")).click();

Thanks
Rashmi

Reply all
Reply to author
Forward
0 new messages