Both the methods in selenium almost plays a similar role. Submit is specific to some forms in which the internal tag is designed in the way that it has acceptance to Submit() method.
submit()
Submits the element to the web server. If this current element is a form, or an element within a form then this will be submitted to the web server. If this causes the current page to change, then this method will block until the new page is loaded. StaleElementReferenceException is thrown when the target element is no longer valid in the document DOM.
click()
Click on the element. If the click causes a new page to load, the method will attempt to block until the page has loaded. After calling the method, you should discard all references to this element unless you know that the element and the page will still be present. Otherwise, any further operations performed on this element will have undefined behavior. ElementNotVisibleException is thrown when the target element is not visible. StaleElementReferenceException is thrown when the target element is no longer valid in the document DOM(document object model).
submit()
Submits the element to the web server. If this current element is a form, or an element within a form then this will be submitted to the web server. If this causes the current page to change, then this method will block until the new page is loaded. StaleElementReferenceException is thrown when the target element is no longer valid in the document DOM.
click()
Click on the element. If the click causes a new page to load, the method will attempt to block until the page has loaded. After calling the method, you should discard all references to this element unless you know that the element and the page will still be present. Otherwise, any further operations performed on this element will have undefined behavior. ElementNotVisibleException is thrown when the target element is not visible. StaleElementReferenceException is thrown when the target element is no longer valid in the document DOM(document object model).
No comments:
Post a Comment