如何解决Web组件测试错误?

时间:2018-10-04 13:48:46

标签: java git selenium-webdriver polymer web-component-tester

你好,任何人阅读:

当前,我正在尝试在演示存储库中运行测试,如here所示。

执行npx wct命令后,我看到以下内容:

TYS-ITS-169599:wct-eyes-example lhuddlesto$ npx wct
Eyes WCT plugin loaded.
Starting Selenium server for local browsers
Selenium server running on port 52187

然后紧接着,我看到了这个巨大的错误:

chrome 69                Tests failed: {"value":{"stacktrace":"java.lang.UnsupportedOperationException: Cannot define class using reflection\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Unavailable.defineClass(ClassInjector.java:822)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.inject(ClassInjector.java:186)\n\tat net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:199)\n\tat net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default.load(ClassLoadingStrategy.java:126)\n\tat net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:79)\n\tat net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4225)\n\tat net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4215)\n\tat org.openqa.selenium.remote.Augmenter.performAugmentation(Augmenter.java:145)\n\tat org.openqa.selenium.remote.Augmenter.create(Augmenter.java:63)\n\tat org.openqa.selenium.remote.BaseAugmenter.augment(BaseAugmenter.java:109)\n\tat org.openqa.selenium.remote.server.RemoteSession.<init>(RemoteSession.java:90)\n\tat org.openqa.selenium.remote.server.ServicedSession.<init>(ServicedSession.java:60)\n\tat org.openqa.selenium.remote.server.ServicedSession$Factory.newActiveSession(ServicedSession.java:175)\n\tat org.openqa.selenium.remote.server.ServicedSession$Factory.newActiveSession(ServicedSession.java:86)\n\tat org.openqa.selenium.remote.server.RemoteSession$Factory.performHandshake(RemoteSession.java:166)\n\tat org.openqa.selenium.remote.server.ServicedSession$Factory.apply(ServicedSession.java:159)\n\tat org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12(ActiveSessionFactory.java:176)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)\n\tat java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)\n\tat java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)\n\tat java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)\n\tat java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)\n\tat java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)\n\tat java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)\n\tat java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)\n\tat org.openqa.selenium.remote.server.ActiveSessionFactory.apply(ActiveSessionFactory.java:179)\n\tat org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2(NewSessionPipeline.java:65)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)\n\tat java.base/java.util.Collections$2.tryAdvance(Collections.java:4745)\n\tat java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)\n\tat java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)\n\tat java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)\n\tat java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)\n\tat java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)\n\tat org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3(NewSessionPipeline.java:68)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.stream.DistinctOps$1$2.accept(DistinctOps.java:175)\n\tat java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)\n\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)\n\tat java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)\n\tat java.base/java.util.stream.Streams$StreamBuilderImpl.tryAdvance(Streams.java:397)\n\tat java.base/java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:720)\n\tat java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)\n\tat java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)\n\tat java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)\n\tat java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)\n\tat java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)\n\tat org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession(NewSessionPipeline.java:71)\n\tat org.openqa.selenium.remote.server.commandhandler.BeginSession.execute(BeginSession.java:65)\n\tat org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$1(WebDriverServlet.java:246)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\nCaused by: java.lang.IllegalStateException: Could not find sun.misc.Unsafe\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$Disabled.initialize(ClassInjector.java:1417)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe.inject(ClassInjector.java:1253)\n\tat net.bytebuddy.dynamic.loading.ClassLoadingStrategy$ForUnsafeInjection.load(ClassLoadingStrategy.java:466)\n\tat net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:79)\n\tat net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4225)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Indirect.make(ClassInjector.java:685)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:303)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:291)\n\tat java.base/java.security.AccessController.doPrivileged(Native Method)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.<clinit>(ClassInjector.java:70)\n\tat net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:196)\n\t... 62 more\nCaused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)\n\tat java.base/java.lang.Class.getMethod(Class.java:2109)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$CreationAction.run(ClassInjector.java:1320)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$CreationAction.run(ClassInjector.java:1308)\n\tat java.base/java.security.AccessController.doPrivileged(Native Method)\n\tat net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe.<clinit>(ClassInjector.java:1185)\n\t... 71 more\n","stackTrace":[{"fileName":"ClassInjector.java","methodName":"defineClass","className":"net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Unavailable","lineNumber":822},{"fileName":"ClassInjector.java","methodName":"inject","className":"net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection","lineNumber":186},{"fileName":"ClassLoadingStrategy.java","methodName":"load","className":"net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher","lineNumber":199},{"fileName":"ClassLoadingStrategy.java","methodName":"load","className":"net.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default","lineNumber":126},{"fileName":"TypeResolutionStrategy.java","methodName":"initialize","className":"net.bytebuddy.dynamic.TypeResolutionStrategy$Passive","lineNumber":79},{"fileName":"DynamicType.java","methodName":"load","className":"net.bytebuddy.dynamic.DynamicType$Default$Unloaded","lineNumber":4225},{"fileName":"DynamicType.java","methodName":"load","className":"net.bytebuddy.dynamic.DynamicType$Default$Unloaded","lineNumber":4215},{"fileName":"Augmenter.java","methodName":"performAugmentation","className":"org.openqa.selenium.remote.Augmenter","lineNumber":145},{"fileName":"Augmenter.java","methodName":"create","className":"org.openqa.selenium.remote.Augmenter","lineNumber":63},{"fileName":"BaseAugmenter.java","methodName":"augment","className":"org.openqa.selenium.remote.BaseAugmenter","lineNumber":109},{"fileName":"RemoteSession.java","methodName":"<init>","className":"org.openqa.selenium.remote.server.RemoteSession","lineNumber":90},{"fileName":"ServicedSession.java","methodName":"<init>","className":"org.openqa.selenium.remote.server.ServicedSession","lineNumber":60},{"fileName":"ServicedSession.java","methodName":"newActiveSession","className":"org.openqa.selenium.remote.server.ServicedSession$Factory","lineNumber":175},{"fileName":"ServicedSession.java","methodName":"newActiveSession","className":"org.openqa.selenium.remote.server.ServicedSession$Factory","lineNumber":86},{"fileName":"RemoteSession.java","methodName":"performHandshake","className":"org.openqa.selenium.remote.server.RemoteSession$Factory","lineNumber":166},{"fileName":"ServicedSession.java","methodName":"apply","className":"org.openqa.selenium.remote.server.ServicedSession$Factory","lineNumber":159},{"fileName":"ActiveSessionFactory.java","methodName":"lambda$apply$12","className":"org.openqa.selenium.remote.server.ActiveSessionFactory","lineNumber":176},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$3$1","lineNumber":195},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$11$1","lineNumber":442},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$2$1","lineNumber":177},{"fileName":"Spliterators.java","methodName":"tryAdvance","className":"java.util.Spliterators$ArraySpliterator","lineNumber":958},{"fileName":"ReferencePipeline.java","methodName":"forEachWithCancel","className":"java.util.stream.ReferencePipeline","lineNumber":127},{"fileName":"AbstractPipeline.java","methodName":"copyIntoWithCancel","className":"java.util.stream.AbstractPipeline","lineNumber":502},{"fileName":"AbstractPipeline.java","methodName":"copyInto","className":"java.util.stream.AbstractPipeline","lineNumber":488},{"fileName":"AbstractPipeline.java","methodName":"wrapAndCopyInto","className":"java.util.stream.AbstractPipeline","lineNumber":474},{"fileName":"FindOps.java","methodName":"evaluateSequential","className":"java.util.stream.FindOps$FindOp","lineNumber":150},{"fileName":"AbstractPipeline.java","methodName":"evaluate","className":"java.util.stream.AbstractPipeline","lineNumber":234},{"fileName":"ReferencePipeline.java","methodName":"findFirst","className":"java.util.stream.ReferencePipeline","lineNumber":543},{"fileName":"ActiveSessionFactory.java","methodName":"apply","className":"org.openqa.selenium.remote.server.ActiveSessionFactory","lineNumber":179},{"fileName":"NewSessionPipeline.java","methodName":"lambda$null$2","className":"org.openqa.selenium.remote.server.NewSessionPipeline","lineNumber":65},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$3$1","lineNumber":195},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$2$1","lineNumber":177},{"fileName":"Collections.java","methodName":"tryAdvance","className":"java.util.Collections$2","lineNumber":4745},{"fileName":"ReferencePipeline.java","methodName":"forEachWithCancel","className":"java.util.stream.ReferencePipeline","lineNumber":127},{"fileName":"AbstractPipeline.java","methodName":"copyIntoWithCancel","className":"java.util.stream.AbstractPipeline","lineNumber":502},{"fileName":"AbstractPipeline.java","methodName":"copyInto","className":"java.util.stream.AbstractPipeline","lineNumber":488},{"fileName":"AbstractPipeline.java","methodName":"wrapAndCopyInto","className":"java.util.stream.AbstractPipeline","lineNumber":474},{"fileName":"FindOps.java","methodName":"evaluateSequential","className":"java.util.stream.FindOps$FindOp","lineNumber":150},{"fileName":"AbstractPipeline.java","methodName":"evaluate","className":"java.util.stream.AbstractPipeline","lineNumber":234},{"fileName":"ReferencePipeline.java","methodName":"findFirst","className":"java.util.stream.ReferencePipeline","lineNumber":543},{"fileName":"NewSessionPipeline.java","methodName":"lambda$createNewSession$3","className":"org.openqa.selenium.remote.server.NewSessionPipeline","lineNumber":68},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$3$1","lineNumber":195},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$3$1","lineNumber":195},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$3$1","lineNumber":195},{"fileName":"DistinctOps.java","methodName":"accept","className":"java.util.stream.DistinctOps$1$2","lineNumber":175},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$2$1","lineNumber":177},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$3$1","lineNumber":195},{"fileName":"ReferencePipeline.java","methodName":"accept","className":"java.util.stream.ReferencePipeline$2$1","lineNumber":177},{"fileName":"Streams.java","methodName":"tryAdvance","className":"java.util.stream.Streams$StreamBuilderImpl","lineNumber":397},{"fileName":"Streams.java","methodName":"tryAdvance","className":"java.util.stream.Streams$ConcatSpliterator","lineNumber":720},{"fileName":"ReferencePipeline.java","methodName":"forEachWithCancel","className":"java.util.stream.ReferencePipeline","lineNumber":127},{"fileName":"AbstractPipeline.java","methodName":"copyIntoWithCancel","className":"java.util.stream.AbstractPipeline","lineNumber":502},{"fileName":"AbstractPipeline.java","methodName":"copyInto","className":"java.util.stream.AbstractPipeline","lineNumber":488},{"fileName":"AbstractPipeline.java","methodName":"wrapAndCopyInto","className":"java.util.stream.AbstractPipeline","lineNumber":474},{"fileName":"FindOps.java","methodName":"evaluateSequential","className":"java.util.stream.FindOps$FindOp","lineNumber":150},{"fileName":"AbstractPipeline.java","methodName":"evaluate","className":"java.util.stream.AbstractPipeline","lineNumber":234},{"fileName":"ReferencePipeline.java","methodName":"findFirst","className":"java.util.stream.ReferencePipeline","lineNumber":543},{"fileName":"NewSessionPipeline.java","methodName":"createNewSession","className":"org.openqa.selenium.remote.server.NewSessionPipeline","lineNumber":71},{"fileName":"BeginSession.java","methodName":"execute","className":"org.openqa.selenium.remote.server.commandhandler.BeginSession","lineNumber":65},{"fileName":"WebDriverServlet.java","methodName":"lambda$handle$1","className":"org.openqa.selenium.remote.server.WebDriverServlet","lineNumber":246},{"fileName":"Executors.java","methodName":"call","className":"java.util.concurrent.Executors$RunnableAdapter","lineNumber":515},{"fileName":"FutureTask.java","methodName":"run","className":"java.util.concurrent.FutureTask","lineNumber":264},{"fileName":"ThreadPoolExecutor.java","methodName":"runWorker","className":"java.util.concurrent.ThreadPoolExecutor","lineNumber":1128},{"fileName":"ThreadPoolExecutor.java","methodName":"run","className":"java.util.concurrent.ThreadPoolExecutor$Worker","lineNumber":628},{"fileName":"Thread.java","methodName":"run","className":"java.lang.Thread","lineNumber":834}],"message":"Cannot define class using reflection","error":"unknown error"},"status":13}
chrome 69                Failed to quit: {"message":"[quit()] Error response status: 9, UnknownCommand - The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource. Selenium error: Unable to find command matching DELETE to /session","status":9,"cause":{"sessionId":null,"value":{"error":"unknown command","message":"Unable to find command matching DELETE to /session","stacktrace":""},"status":9},"jsonwire-error":{"status":9,"summary":"UnknownCommand","detail":"Th...

在我看来,该错误与Java有关,因此我尝试卸载并重新安装它。有没有其他人遇到此错误?谢谢。

1 个答案:

答案 0 :(得分:0)

有一个已知的incompatibility issue with Java 10。当前的解决方法是降级到Java 8,如Polymer 3模板项目的README中所述:

  

运行测试

p
     

您的应用程序已经设置为可以通过web-component-tester进行测试。运行p.next以在本地运行应用程序的测试套件。 Java SE Development Kit 8是必需的。请注意,如果未安装$ polymer test 命令,则将提示您安装Java10。要卸载Java,请参见指导here。参见issue #405 for the status of Java 10 support