Selenium interview Q | Selenium Forum
M
Posted on 11/11/2015
Hi Ashish,
Can you please explain below with an example? I went through the documentation, but i could not get it.

What is the differance between WebElement.click() and WebElement. Submit() method?

M
Replied on 12/11/2015

click() : will work for the button/element if it is of 'type' - button or submit
submit(): will work only when 'type' is submit.


M
Replied on 13/11/2015

submit() - If you call this on an element within a [b:2ho1r5es]form[/b:2ho1r5es], WebDriver will walk up the DOM until it finds the [b:2ho1r5es]enclosing form[/b:2ho1r5es] and then calls submit on that. [b:2ho1r5es]If the element isn’t in a form tag[/b:2ho1r5es], then the [b:2ho1r5es]NoSuchElementException [/b:2ho1r5es]will be thrown.