我正在尝试使用流畅的等待
@Component
@Scope(SCOPE_CUCUMBER_GLUE)
public class UserCreationPageImpl extends BaseBinariosPage implements UserCreationPage {
Wait<WebDriver> wait = new FluentWait<WebDriver>( driver )
.withTimeout(Duration.ofSeconds(30))
.pollingEvery(Duration.ofSeconds(5))
.ignoring(NoSuchElementException.class);
但当我调试时,我得到驱动器=空
这是我安装司机的地方
@Page
public abstract class BaseBinariosPage {
@Autowired
protected WebDriver driver;
@Autowired
private QAStarterConfigProperties qaStarterConfigProperties;
public BaseBinariosPage() {
}
@Init
public void init() {
this.driver.get(this.qaStarterConfigProperties.getAppUrl() + this.getPageEndPoint());
PageFactory.initElements(this.driver, this);
}
protected abstract String getPageEndPoint();
}
当您声明一个变量时,默认情况下它将被赋值为null。BaseBinariosPage中没有创建驱动程序对象的构造函数,您希望它如何具有驱动程序对象。
添加以下内容:
public BaseBinariosPage() {
driver = new ChromeDriver()
}