【发布时间】:2017-10-21 15:45:48
【问题描述】:
我将WebDriver 实例传递给下面的类
FunctionalComponents fc = new FunctionalComponents(driver)
来自另一个类,但对象创建发生在构造函数执行之前。实际上,创建的对象在驱动程序实例中具有null 值。
我该如何解决这个问题?
public class FunctionalComponents
{
public FunctionalComponents(WebDriver driver)
{
this.driver = driver;
}
CaptureElement element= new CaptureElement(driver);
public void Method()
{
// method logic
// i call object element here
}
}
【问题讨论】: