Let's say I have an input
in a form (looks like a button and interacts like a button) which generates some data (well, the server generates the data based on the form parameters, but for the user, the button does it :) )based on the parameters in the form.
When I use click()
, the whole process hangs (it actually freezes, no exceptions or errors).
From the Selenium website:
// Now submit the form. WebDriver will find the form for us from the element element.submit();
So WebDriver has a submit()
method. Is there any difference, logic wise, between using a click()
on a button or submit()
?
How to use the Selenium Click command. To put it in simple words, the click command emulates a click operation for a link, button, checkbox or radio button. In Selenium Webdriver, execute click after finding an element. In SeleniumIDE, the recorder will do the identifying, and the command is simply click.
The submit() function is there to make life easier. You can use it on any element inside of form tags to submit that form. You can also search for the submit button and use click() . So the only difference is click() has to be done on the submit button and submit() can be done on any form element.
You could try to find the element with an XPath expression or a CSS selector like input[type="button"], and then just click the element.
Move to Element: contextClick() method first performs mouseMove to the middle of the element location. This function performs the right click at the middle of the web element.
The submit()
function is there to make life easier. You can use it on any element inside of form tags to submit that form.
You can also search for the submit button and use click()
.
So the only difference is click()
has to be done on the submit button and submit()
can be done on any form element.
It's up to you.
http://docs.seleniumhq.org/docs/03_webdriver.jsp#user-input-filling-in-forms
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With