Selenium Java 中 By 关键字的用途是什么
示例代码:
public class RediffLoginPage
{
Webdriver driver;
public RediffLoginPage(Webdriver driver){
this.driver=driver;
}
By username=By.xpath(".//*(@id='login1']");
By Password=By.name("passwd");
}
public Webelement Emailid()
{
return driver.findElement(username);
}
public Webelement Password(){return driver.findElement(Password);}
在这一行中,
By username=By.xpath(".//*(@id='login1']");
第一个 By
关键字的用途是什么?
它是测试用例的对象存储库代码。
Sample Code:
public class RediffLoginPage
{
Webdriver driver;
public RediffLoginPage(Webdriver driver){
this.driver=driver;
}
By username=By.xpath(".//*(@id='login1']");
By Password=By.name("passwd");
}
public Webelement Emailid()
{
return driver.findElement(username);
}
public Webelement Password(){return driver.findElement(Password);}
In this line,
By username=By.xpath(".//*(@id='login1']");
what's the purpose of first By
keyword here?
It's object repository code for a testcase.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类
类 扩展 < em>
java.lang.Object
并定义为:By
具有以下直接已知子类:Class By
Class By extends
java.lang.Object
and is defined as:By
have the following direct known Subclasses: