Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
selenium将如何处理:java.lang.ClassNotFoundException:com.google.common.base.function引起的异常?_Selenium_Selenium Webdriver_Selenium Grid - Fatal编程技术网

selenium将如何处理:java.lang.ClassNotFoundException:com.google.common.base.function引起的异常?

selenium将如何处理:java.lang.ClassNotFoundException:com.google.common.base.function引起的异常?,selenium,selenium-webdriver,selenium-grid,Selenium,Selenium Webdriver,Selenium Grid,原因:java.lang.ClassNotFoundException:com.google.common.base.function将在selenium中处理 在运行Webdriver时出现此错误 public class Logintoaccount { @Before public void setUp() throws Exception { System.setProperty("webdriver.ie.driver", "d:\\IEDriverServe

原因:java.lang.ClassNotFoundException:com.google.common.base.function将在selenium中处理

在运行Webdriver时出现此错误

public class Logintoaccount {

    @Before
    public void setUp() throws Exception {
    System.setProperty("webdriver.ie.driver", "d:\\IEDriverServer.exe");
    WebDriver driver = new InternetExplorerDriver();

    }

    @Test
    public void test() {
        //System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe");        
    }
}

以下是您面临的问题的解决方案:

您以前使用的注释为@。按照TestNG的文档,您只能使用以下以@Before开头的注释:

  • @套房前
  • @课前
  • @试验前
  • @前团体
  • @预处理法
  • 使用一个适合你的测试策略。这会解决你的问题。请记住导入这些类​ 仅来自TestNG


    让我知道这是否对您有帮助。

    使用@BeforeTest而不是@Before,因为此安装()将在测试开始时运行。

    我认为您在构建路径中缺少Selenium独立服务器。添加所需的版本,你会很好去

    selenium-server-standalone-version.jar
    

    在项目中添加selenium server standalone version.jar文件。该问题将得到解决

    我正在使用Junit框架运行套件的可能重复。你能按照JUnit来指导吗。TIA@KapilBisht你的问题没有提到Junit。我试图用最概括的方法回答你的问题。您能接受这个答案作为问题的解决方案并提出一个新的Junit特定查询吗?我很乐意帮助你。谢谢。谢谢。问题解决了。我错过了要添加到项目中的selenium-server-standalone-version.jar文件。非常感谢:)嗨,Sudheer,我正在使用JUnit来运行这个套件。您能否根据JUNIT pleaseCode wise进行指导?我看不到任何问题,您是否已在构建路径中导入selenium-java-2.53.1.jar和selenium-java-2.53.1-srcs.jar?我正在使用最新版本的selenium webdriver(版本3.3.1)。我觉得最新版本的selenium在执行测试用例方面存在问题。请帮助我错过了要添加到项目中的selenium-server-standalone-version.jar文件,这就是它抛出错误的原因。它将从某处下载?你能给我提供链接吗。