-> Both click() and submit() both are used to click Button in Web page.
-> Selenium Webdriver has one special method to submit any form and that method name Is submit(). submit() method works same as clicking on submit button.
When to use .click() method :
-> You can use .click() method to click on any button.There is no restriction for click buttons.
-> That means element's type = "button" or type = "submit", .click() method will works for both.
-> If button is inside <form> tag or button is outside <form> tag, the click() method will work.
When to use .submit() method :
-> we can use .submit() method for only submit form after click on button.
-> That means element's type = "submit" and button should be inside <form> tag, then only submit() will work.
-> if element's type = "button" means submit() will not work.
-> If button outside of the <form> tag means submit() will not work
For Example, Submit() will work if submit button should be inside <form> tag and element type="submit" as below
<form>
<input id="submitbutton" name="submitbutton" type="submit" value="Next step" class="g-button g-button-submit">
</form>
But click() method will work for all buttons in webpage with out any restrictions.
Nice explanation.
ReplyDeleteTried the same for facebook signup. Even for type submit, inside form also submit() is not working.
ReplyDeleteFinally a great explanation to this question. Thanks mate.
ReplyDeleteYour posts never fail to remind me of the importance of gratitude in our lives. Clicks Per Second is like a hidden gem for gamers, and I couldn't resist recommending it to someone as passionate as you!
ReplyDeleteI'm grateful for the sense of community and belonging your blog provides! Gear up for some laugh-out-loud moments and heart-pounding action in Funny Shooter 2 Unblocked - it's the ultimate gaming thrill!
ReplyDeleteWell-researched, well-written, and highly informative – this article ticks all the boxes. Don't miss this must-read, mental age quiz. Our skills assessment provides benchmarks across key cognitive domains like reasoning, memory, and processing speed.
ReplyDeleteTu blog ofrece constantemente consejos prácticos que me ayudan. Gracias por tu dedicación a difundir positividad. Contador De Clicks Online es una herramienta imprescindible para los jugadores que buscan mejorar su velocidad de clic. Pon a prueba tu CPS y trabaja para ser más rápido con cada sesión.
ReplyDeleteThank you for offering such meaningful advice. Your blog consistently helps me stay motivated and focused on my goals. Visit this article for more advice. Ready to see how fast you can click? Take the Clicks Per Second Test now and keep practicing to break your own personal records.
ReplyDelete