Reputation: 422
A page contains a form with element
<input type="submit" class="button primary" value="Submit" accesskey="s">
I attempted all the next options to select that button
//driver.findElement((By.cssSelector("//*@id='QuickReply']/div[2]/input[2]"))).submit(); //this path is from firebug
//driver.findElement(By.className("button.primary")).submit();
driver.findElement(By.tagName("form")).submit();
But I get errors with those selects. What is wrong?
Upvotes: 2
Views: 8832
Reputation: 23835
You should try using .click()
instead of .submit()
as below :-
driver.findElement(By.cssSelector("input.button.primary[value='Submit']")).click();
Upvotes: 3
Reputation: 9058
Try this
"//input[@class='button primary']" or "//input[@value='Submit']"
Upvotes: 5