当前位置: 首页 > 工具软件 > selenide > 使用案例 >

Selenide框架方法SelenideElement.java文件解析

骆文彬
2023-12-01

SelenideElement.java

setValue

SelenideElement setValue(string): 输入字符串

val

SelenideElement val():
t要附加到文本字段中的任何文本。

String val()
Get the “value” attribute of the element
Returns: attribute “value” value or null if attribute is missing
获取元素的“value”属性
返回: 属性“value”值,如果缺少属性,则为null

append

SelenideElement append(String text); 可追加value

pressEnter/pressTab/pressEscape

getText()

Get the text of the element WITHOUT children.

getOwnText() /innetTest()可以获取隐藏元素文本

Get the text code of the element with children.
It can be used to get the text of a hidden element.

innerHtml

Get the attribute of the element. Synonym for getAttribute(String)

String attr(String attributeName);

attribute “name” value or null if attribute is missing

String pseudo(String pseudoElementName, String propertyName) 伪元素属性

Get content of the pseudo-element
Params:
pseudoElementName – pseudo-element name of the element, “:before”, “:after”
Returns:
the content value or “none” if the content is missing

String pseudo(String pseudoElementName)/selectRadio radio 按钮属性

Select radio button
Params:
value – value of radio button to select
Returns:
selected “input type=radio” element

data(String dataAttributeName)

获取属性信息

getAttribute(String name)/getCssValue(String propertyName);

Get the value of a given CSS property;

exists()/isDisplayed()

exisits() : Check if this element exists and visible.
isDisplayed: 没有等待时间

is(Condition Condition)

如果元素与给定条件匹配,则立即返回true。方法不等待!警告:此方法有助于实现crooks,但对于典型的ui测试不需要此方法。

has/

SelenideElement setSelected(boolean selected)

Checks that given element meets all of given conditions.

should/shouldHave/shouldBe

返回element元素 有默认等待时间,可以加等待时间;
可以多条件同时使用;
$("#errorMessage").should(exist);

shouldNot/shouldNotHave/shouldNotBe

waitUntil

可以自定义等待时间

 类似资料: