selenium webdriver - WebElement is an interface - how can methods be called on it successfully? -
since webelement interface, means methods present in webelement interface abstract, i.e. don't have body. also, know cannot access methods of interface directly using reference interface (because methods don't have implementation)
now, consider following code:
webelement button = driver.findelement(//xpath of button); button.click(); can explain how possible here access click() method of interface webelement through 'button' nothing reference interface webelement?
the webelement interface implemented androidwebelement, htmlunitwebelement, or remotewebelement.
the click method executed on 1 of these concrete classes (which returned findelement).
see following documentation further details:
Comments
Post a Comment