我跟随tutorial about Selenium with Java。我按照说明添加了maven依赖:
<dependency>
<groupId>io.ddavison</groupId>
<artifactId>conductor</artifactId>
<version>1.1</version>
</dependency>
然后运行mvn install
但是当我创建类&#34; HomePage&#34;,导入到org.openqa.selenium.By
时,IntelliJ说:Cannot resolve symbol 'openqa'
package com.mysite.selenium;
import org.openqa.selenium.By;
public class HomePage {
// the tabs
public static final String LOC_LNK_PROJECTSTAB = "li#menu_projects a[href$='projects/']";
public static final String LOC_LNK_DOWNLOADTAB = "li#menu_download a[href$='download/']";
public static final By LOC_LNK_DOCUMENTATIONTAB = By.xpath("//li[@id='menu_documentation']/a[contains(@href, 'docs/')]");
public static final String LOC_LNK_SUPPORTTAB = "li#menu_support a[href$='support/']";
public static final String LOC_LNK_ABOUTTAB = "li#menu_about a[href$='about/']";
// download link
public static final By LOC_LNK_DOWNLOADSELENIUM = By.linkText("Download Selenium");
}
任何帮助将不胜感激!
答案 0 :(得分:1)
类org.openqa.selenium.By
在selenium-api
中定义,您需要在项目中添加以下依赖项:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.11.0</version>
</dependency>
请注意,3.11.0版本不是必需的 - 您可以选择其他版本。例如,io.ddavison:conductor:1.1
使用的是Selenium 2.43.1。你需要:
io.ddavison:conductor