ChromeDriver和WebDriver for Selenium通过TestNG导致4个错误 [英] ChromeDriver and WebDriver for Selenium through TestNG results in 4 errors

查看:624
本文介绍了ChromeDriver和WebDriver for Selenium通过TestNG导致4个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做网站所说的内容,但会导致4个错误...

I'm doing exactly what the website says but it results in 4 errors...

推荐答案

确实存在 4 错误如下:


  • 错误 ChromeDriver无法解析为某种类型


  • 解决方案:您需要添加以下导入

  • Solution: You need to add the following import

import org.openqa.selenium.chrome.ChromeDriver; 


  • 在这里你可以找到关于 chrome webdriver无法解析为类型错误eclipse和java

  • Here you can find a discussion on chrome Webdriver can't be resolved to a type error eclipse and java
  • 错误测试无法解析为


    • 解决方案:您需要添加以下导入

    • Solution: You need to add the following import

    import org.testng.annotations.Test;
    //or
    import org.junit.Test;
    


    错误公共类型ChromeTest必须在自己的文件中定义


    • 解决方案:您的文件名是 Chrom.java ,但您的类名是 ChromeTest ,因为两者都应该相似。将它们更改为相同。

    • Solution: Your filename is Chrom.java but your classname is ChromeTest where as both should have been similar. Change them as identical.

    在这里您可以找到关于公共类型必须在它自己的文件中定义但是文件名和班级名称相同

    Here you can find a discussion on "The public type must be defined in its own file" but the file name and the class name is the same

    错误 WebDriver无法解析为某种类型


    • 解决方案:您需要添加以下导入

    • Solution: You need to add the following import

    import org.openqa.selenium.WebDriver;
    



    • 您必须保留文件名(当前 Chrom.java )和您的班级名称(目前 ChromeTest )与强制措施相同。

    • 无论何时使用任何课程,都需要提及相关的导入。您可以鼠标悬停错误并选择相关的导入。

    • 您应该添加 testng jar或 junit 罐子,但不是两个。

    • You have to keep the filename (currently Chrom.java) and your classname (currently ChromeTest) identical as a mandatory measure.
    • You need to mention the related imports whenever you are using any class. You can Mouse Hover over the error and choose the relevant import.
    • You should either add the testng jars or the junit jars but not both of them.

    这篇关于ChromeDriver和WebDriver for Selenium通过TestNG导致4个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆