Java HtmlElementDecorator(驱动程序)中的不兼容类型错误

Java HtmlElementDecorator(驱动程序)中的不兼容类型错误,java,htmlelements,Java,Htmlelements,我已经开始研究Yandex Html元素框架。我是根据《起步指南》做的 一开始就停下来 public class MainPage { private WebDriver driver; @FindBy(className = "b-morda-search-form") private SearchArrow searchArrow; public MainPage(final WebDriver driver) { PageFactory.initElements(new Ht

我已经开始研究Yandex Html元素框架。我是根据《起步指南》做的

一开始就停下来

public class MainPage {

private WebDriver driver;

@FindBy(className = "b-morda-search-form")
private SearchArrow searchArrow;

public MainPage(final WebDriver driver) {
    PageFactory.initElements(new HtmlElementDecorator(driver), this);
    this.driver = driver;
}

public SearchPage searchFor(String request) {
    this.searchArrow.searchFor(request);
    return new SearchPage(driver);
}
}
线

创建错误

错误:(26,59)java:不兼容的类型:org.openqa.selenium.WebDriver 无法转换为 ru.yandex.qatools.htmlelements.pagefactory.CustomElementLocatorFactory

它只是这样工作的:

PageFactory.initElements(new HtmlElementDecorator(new HtmlElementLocatorFactory(driver)), this);
为什么?

我使用的是IDEA 15 Ultimate,Java 8

pom文件:

<project xmlns="http://maven.apache.org/POM/4.0.0"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

<groupId>vasidizus</groupId>
<artifactId>Autotest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Autotest</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
</dependency>

<dependency>
  <groupId>ru.yandex.qatools.htmlelements</groupId>
  <artifactId>htmlelements-java</artifactId>
  <version>1.15</version>
</dependency>

<dependency>
  <groupId>ru.yandex.qatools.htmlelements</groupId>
  <artifactId>htmlelements-matchers</artifactId>
  <version>1.15</version>
</dependency>

<dependency>
  <groupId>ru.yandex.qatools.matchers</groupId>
  <artifactId>webdriver-matchers</artifactId>
  <version>1.2</version>
</dependency>

<dependency>
  <groupId>ru.yandex.qatools.matchers</groupId>
  <artifactId>common-matchers</artifactId>
  <version>1.2</version>
</dependency>

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>2.48.2</version>
</dependency>

</dependencies>
</project>

4.0.0
血管
自动测试
1.0-快照
罐子
自动测试
http://maven.apache.org
UTF-8
朱尼特
朱尼特
4.12
ru.yandex.qatools.htmlelements
Htmlements java
1.15
ru.yandex.qatools.htmlelements
htmlelements匹配器
1.15
ru.yandex.qatools.matchers
Web驱动程序匹配器
1.2
ru.yandex.qatools.matchers
普通匹配器
1.2
org.seleniumhq.selenium
硒爪哇
2.48.2
提前谢谢

public HtmlElementDecorator(CustomElementLocatorFactory factory) {
       this.factory = factory;
}
因此,HtmlElementDecorator的构造函数基本上只接受CustomElementLocatorFactory,因此出现了“不兼容类型”错误

仅供参考,而不是

PageFactory.initElements(new HtmlElementDecorator(new HtmlElementLocatorFactory(driver)), this);
你也可以使用

HtmlElementLoader.populatePageObject(this, driver);
HtmlElementLoader.populatePageObject(this, driver);