Я начал изучать фреймворк Yandex Html Elements. Делаю по инструкции https://github.com/yandex-qatools/htmlelements-examples/blob/master/htmlelements-junit-example/src/site/junit-example.md
И остановись в начале
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);
}
}
линия
PageFactory.initElements(new HtmlElementDecorator(driver), this);
создать ошибку
Ошибка:(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>
Заранее спасибо