gpt4 book ai didi

java - Selenium WebDriver 中的 getText() 和 getAttribute() 有什么区别?

转载 作者:搜寻专家 更新时间:2023-10-30 21:14:20 25 4
gpt4 key购买 nike

两者都用于获取标签之间的 WebElement 值。

我的假设对吗?如有错误,请详细说明。

最佳答案

  <input attr1='a' attr2='b' attr3='c'>foo</input>

getAttribute(attr1) 你得到 'a'

getAttribute(attr2) 你得到 'b'

getAttribute(attr3) 你得到 'c'

getText() 没有参数你只能得到 'foo'

关于java - Selenium WebDriver 中的 getText() 和 getAttribute() 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32307702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com