Actions Wbdriver build.perform ()

Can someone tell me the difference between build.perform() and perform() in Selenium actions?

Example:

 actions.moveToElement(menuHoverLink).perform(); 

and

 actions.moveToElement(menuHoverLink).build().perform(); 
+7
selenium-webdriver
source share
2 answers

In your scenario, this will not change using both. The difference occurs in the place when you perform several actions, for example:

 Actions builder = new Actions(driver); builder.clickAndHold(element1) .clickAndHold(element2) .click() .build() .perform(); 

in the above code, we perform several operations, so we need to use build () to compile all the actions in one step. Thus, the build () method is used to compile all of the above actions in one step. We use the build () function when we perform a sequence of operations and do not need to use it if we perform one action.

+16
source share

It's a bit late for the party, but you don't need to use build() if you don't want to pass the IActions object, since build() is executed by perform() (see WebDriver Actions.Perform () or Actions.Build (). Execute () )

+1
source share

All Articles