0

Necesito ayuda por favor, tengo la siguiente prueba de junit con selenium: realice esta prueba y ya intente solucionarla actualizando dependencias, actualizando la libreria de junit pero no lo he logrado.

import java.util.UUID;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class RegisterTest {

    private WebDriver driver;
    final String randomEmail = randomEmail();

    @Before
    public void setUp() {
        System.setProperty("webdriver.chrome.driver", "./src/test/java/mx/uaq/selenium/resources/drivers/chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().window().setSize(new Dimension(1302, 835));
        driver.get("http://localhost:9984/CursosDRHv2/");
    }

    @Test 
    public void test() {
        driver.findElement(By.cssSelector(".tab:nth-child(2) > a")).click();
        driver.findElement(By.id("select2-tipo-container")).click();
        driver.findElement(By.xpath("//option[. = \'EXTERNO\']")).click();
        driver.findElement(By.id("modalInformacionRegistro")).click();   
        driver.findElement(By.cssSelector(".btnAceptar:nth-child(1)")).click();  
        driver.findElement(By.id("nombre"));
        driver.findElement(By.id("nombre")).sendKeys("miguel");
        driver.findElement(By.id("apPaterno")).sendKeys("bar");
        driver.findElement(By.cssSelector(".row:nth-child(2) > .input-field:nth-child(2)")).click();
        driver.findElement(By.id("correoPersonal")).click();
        driver.findElement(By.id("correoPersonal")).sendKeys(randomEmail());
        driver.findElement(By.id("btnAgregarUsuario")).click();
        driver.close();
      }

    private static String randomEmail() {
        return UUID.randomUUID().toString().replace("-", "") + "@example.com";
       }

    @After
    public void teardDown() {
        driver.quit();
    }
}

y al momento de ejecutarla me lanza el siguiente error que ya trate de resolver actualizando las dependencias pero no se soluciona: es una prueba usando selenium, junit, en un proyecto maven y en el pom.xml hay mas dependencias de las que se utilizan para la prueba ya que se utilizan en otra parte del proyecto y pienso que algunas de esas estan causando incompatibilidad por lo que estado leyendo.

    java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector;
    at org.openqa.selenium.chromium.ChromiumOptions.asMap(ChromiumOptions.java:241)
    at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:94)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:69)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:139)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:582)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:136)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:75)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:105)
    at mx.uaq.selenium.modules.start.RegisterTest.setUp(RegisterTest.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
    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$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

java.lang.NullPointerException
    at mx.uaq.selenium.modules.start.RegisterTest.teardDown(RegisterTest.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.RunAfters.invokeMethod(RunAfters.java:46)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
4
  • ¿Seguro que funciona ese método randomEmail ?
    – fredyfx
    Commented el 20 mar. 2020 a las 15:58
  • si, ese si funciona, pero creo que hay incompatibilidad con otras dependencias que estoy usando por eso sale este error java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector;
    – Miguel
    Commented el 20 mar. 2020 a las 17:37
  • @fredyfx el problema es que las dependencias de selenium chocan con la de sharepoint
    – Miguel
    Commented el 24 mar. 2020 a las 6:05
  • En ningún lado veo dependencias de Sharepoint o.o
    – fredyfx
    Commented el 24 mar. 2020 a las 16:44

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.