java - build().perform() 和 Perform() 之间有什么区别

标签 java selenium selenium-webdriver webdriver

一些文章建议 现在 build() 包含在 perform() 本身中,而其他人则建议 当要链接多个操作时使用 build().perform() 一起。

最佳答案

build() 包含在 perform() 中,您可以在 source code 中看到它。

public void perform() {
    build().perform();
}

方法内的perform()调用内部类BuiltAction中的perform()方法。

在代码中调用 build().perform() 实际上是调用 build() 两次, build().build().perform() .

build

Generates a composite action containing all actions so far, ready to be performed (and resets the internal builder state, so subsequent calls to build() will contain fresh sequences).

performe

A convenience method for performing the actions without calling build() first.

这几乎没有误导性(IMO),因为正在调用 build(),即使是隐式调用。

关于java - build().perform() 和 Perform() 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54053633/

相关文章:

Selenium 元素隐藏在 float 标题后面

java - 如何在 selenium webdriver 中使用 Canvas GoJS

angularjs - 我可以让 Protractor 使用安装在node_modules中的IEDriverServer.exe webdriver-update吗?

java - 如何使用java在电子邮件正文中发送动态html表

javascript - 可以使用 Node.js 中的传递/帮助函数调用异步生成器吗?

selenium - 在 IE 中找不到元素,但在 FF 中工作正常

Python Selenium 如何处理 while 循环/if else 语句中的 NoSuchElementException

java - 任何人都知道通用事务 map |设置|列表

java - java新手,需要学习如何存储多个同名的Double

java - 在 Java 中将 Oracle 函数作为字符串传递