获取java.lang.NoClassDefFoundError:org / openqa / selenium / Rectangle错误

时间:2017-04-25 04:32:24

标签: selenium

我正在尝试在我的本地实例中运行一段selenium代码并遇到此错误。请帮我弄清楚这个问题,因为我找不到任何博客

java.lang.NoClassDefFoundError: org/openqa/selenium/Rectangle

    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetPublicMethods(Class.java:2902)
    at java.lang.Class.getMethods(Class.java:1615)
    at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:451)
    at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:339)
    at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:639)
    at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)
    at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)
    at java.lang.reflect.WeakCache.get(WeakCache.java:127)
    at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)
    at 

1 个答案:

答案 0 :(得分:0)

我认为你在pom.xml中缺少这种依赖:

以下代码对我有用

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>