首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >类型错配误差

类型错配误差
EN

Stack Exchange QA用户
提问于 2017-09-21 18:50:40
回答 2查看 376关注 0票数 2

我得到了:

类型不匹配:无法从org.openqa.selenium.WebElement转换为WebElement

关于以下代码:

代码语言:javascript
代码运行次数:0
运行
复制
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

public class WebElement {

    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();

        driver.get("https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin");

        WebElement emailField = driver.findElement(By.id("identifierId"));


    }

}
EN

回答 2

Stack Exchange QA用户

发布于 2017-09-21 19:03:08

通过命名类WebElement,您将跟踪导入的WebElement

为你的班级选一个不同的名字。

票数 4
EN

Stack Exchange QA用户

发布于 2017-09-25 17:21:23

当您访问或尝试导入WebElement以定位您的元素时,更改类的名称会引起歧义。

票数 0
EN
页面原文内容由Stack Exchange QA提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://sqa.stackexchange.com/questions/29738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档