Wbdriver操作build.perform() [英] Wbdriver Actions build.perform()

查看:145
本文介绍了Wbdriver操作build.perform()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我硒动作中build.perform()perform()之间的区别吗?

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

示例:

actions.moveToElement(menuHoverLink).perform(); 

actions.moveToElement(menuHoverLink).build().perform();

推荐答案

在您的方案中,两者都不会有所作为.当您要执行多个操作时,差异就发生了:

In your scenario it wont make a difference using both. The difference occurs at place when you have multiple actions to be performed like:

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

在上面的代码中,我们执行了多个操作,因此我们必须使用build()将所有操作编译为一个步骤.因此,使用build()方法将所有列出的动作编译为一个步骤. 我们在执行一系列操作时使用build(),而在执行单个操作时则无需使用.

in the above code we are performing more than one operations so we have to use build() to compile all the actions into a single step. Thus build() method is used compile all the listed actions into a single step. We use build() when we are performing sequence of operations and no need to use if we are performing single action.

这篇关于Wbdriver操作build.perform()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆