Can anybody tell me the difference between build.perform()
and perform()
in Selenium actions?
Example:
actions.moveToElement(menuHoverLink).perform();
and
actions.moveToElement(menuHoverLink).build().perform();
Build(). perform() is used to compile and execute the actions class. Use the different methods under the actions class to perform various operations like click(), drag and drop and so on.
perform() is used when multiple actions are to be chained together. java. selenium. selenium-webdriver. webdriver.
Build the actions sequence: Now, build this sequence using the build() method of Actions class and get the composite action. Build method generates a composite action containing all actions so far which are ready to be performed. Action action = actions. build();
Actions class is an ability provided by Selenium for handling keyboard and mouse events. In Selenium WebDriver, handling these events includes operations such as drag and drop, clicking on multiple elements with the control key, among others. These operations are performed using the advanced user interactions API.
A bit late to the party, but you don't have to use build()
unless you want to pass an IActions
object, as build()
is done by perform()
(see WebDriver Actions.Perform() or Actions.Build().Perform())
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