Selenium teszt - hiányzó csomag hiba
2021-04-01T14:18:34+02:00
2021-04-01T21:03:32+02:00
2022-08-12T01:45:32+02:00
WorkingClassHero
Sziasztok IntelliJ-vel elkezdtem egy új Selenium projectet.  Elindul a program, de amikor a browser-t hozzárendelem a változóhoz, akkor hiányzó import hibát kapok. A korábbi import hibákat már kijavitottam, ugyanakkor nem értem, hogy pl. ez a hiba, vagy akár a már kijavítottak miért jönnek fel, korábban más projekteknél ilyen hiba nem volt.

Ez a forrás kódom :

package mainPackage; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.openqa.selenium.chrome.ChromeDriver; public class mainTest { public static ChromeDriver driver; @BeforeClass public static void beforeClass() { System.setProperty("webdriver.chrome.driver","C:\chromedriver\chromedriver.exe"); driver = new ChromeDriver(); } @Test public void openMyBlog() { driver.get("https://www.softwaretestingmaterial.com/"); driver.quit(); } @AfterClass public static void afterClass() { driver.quit(); } }
És ez a hiba (A
driver = new ChromeDriver();
sornál
) :

 
java.lang.NoClassDefFoundError: io/netty/handler/ssl/SslContextBuilder
 
at org.asynchttpclient.netty.ssl.DefaultSslEngineFactory.buildSslContext(DefaultSslEngineFactory.java:40)
at org.asynchttpclient.netty.ssl.DefaultSslEngineFactory.init(DefaultSslEngineFactory.java:74)
at org.asynchttpclient.netty.channel.ChannelManager.<init>(ChannelManager.java:104)
at org.asynchttpclient.DefaultAsyncHttpClient.<init>(DefaultAsyncHttpClient.java:92)
at org.asynchttpclient.Dsl.asyncHttpClient(Dsl.java:32)
at org.openqa.selenium.remote.http.netty.NettyClient.createHttpClient(NettyClient.java:98)
at org.openqa.selenium.remote.http.netty.NettyClient.<clinit>(NettyClient.java:51)
at org.openqa.selenium.remote.http.netty.NettyClient$Factory.createClient(NettyClient.java:147)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:110)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:96)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:86)
at org.openqa.selenium.remote.service.DriverCommandExecutor.<init>(DriverCommandExecutor.java:68)
at org.openqa.selenium.chromium.ChromiumDriverCommandExecutor.<init>(ChromiumDriverCommandExecutor.java:78)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:99)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:86)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:41)
at mainPackage.mainTest.beforeClass(mainTest.java:18)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: io.netty.handler.ssl.SslContextBuilder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 32 more

Miért kell ide az SslContextBuilder ? Tényleg ez a hiba, vagy valamit ki kéne venne, és akkor ez a hiba nem lesz ?

Ez pedig a pom.xml :



<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>groupId</groupId> <artifactId>SeleniumTest</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/io.netty/netty-all --> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>5.0.0.Alpha2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.asynchttpclient/async-http-client --> <dependency> <groupId>org.asynchttpclient</groupId> <artifactId>async-http-client</artifactId> <version>2.12.3</version> </dependency> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>2.0.0-alpha1</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> <dependency>

<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-alpha1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.0-alpha1</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/io.netty/netty-handler -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>5.0.0.Alpha2</version>
</dependency>


</dependencies>
</project>
Mutasd a teljes hozzászólást!
a pom.xml-be bettetem a szükséges hivatkozásokat, amit mvnrepositories weblapról szedtem le, a hibák alapján
Mutasd a teljes hozzászólást!

abcd