Selenium WebDriver对象可在所有测试/类中使用 [英] Selenium WebDriver object to use across all the tests/classes

查看:106
本文介绍了Selenium WebDriver对象可在所有测试/类中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我会撒谎地知道如何在所有测试和类中声明和使用WEbDriver对象.

由于WebDriver是驱动程序(firefix/IE/Opera ..),因此我想在所有类中使用它来识别应用程序中的网络元素,

目前正在关注,

Hi All,

i would lie to know that how i can declare and user WEbDriver object across all the tests and classes.

since WebDriver is the driver (firefix/IE/Opera..) so i wanted to use in all the classes to identifying webelements in th application,

currently am following as,

Class main(){
 Function Navigate(){
  WebDriver drive=New FireFoxDriver();
 }
}



但是如果我想在另一个名为getAll
的类中使用相同的驱动程序 目前正在关注,



but if i want use same driver in another class called getAll
currently am following as,

Class getAll(){
 Function Listval(){
   driver.getelement(by.id("jk") }
}



它将(驱动程序对象)在这里工作(getAll类)吗?

是一个新手,将使用Webdriver selenium来自动化应用程序.

我很感谢您的解决方案,并热切希望看到.



will it(driver object) work here(getAll class) ?

am new to this and going to use Webdriver selenium to automate the application.

I can appreciate you solution and keen to see.

推荐答案

如果您询问 ^ ]这个问题.
我们始终可以为您提供标准代码的帮助,但是,如果您在寻找产品特定的帮助,最好总是寻求源代码,因为这里不能保证有人能使用它.
You will have more chance if you ask the Selenium Guys[^] this question.
We can always help with standard code, but if you are looking for product specific help, it is always better to go to source as there is no guarantee anyone here uses it.


这篇关于Selenium WebDriver对象可在所有测试/类中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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