0

Hello guys I'm using java 8 / Maven / Spring boot with Spring Security

ChromeDriver 75.0.3770.140 and Chrome with corresponding version.

I am trying to create a test with Selenium and I have a problem!

If I put the youtube, google or other site the browser opens in the test and runs OK, but when I try localhost: 8080 doesn't open my page!

I also get a warning!

Has anyone ever experienced this?

My dependencies

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.52.0</version>
    </dependency>

My Test Code

@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringbootTestApplicationTests {

WebDriver driver;

@Before
public void when_the_test_starts() {
    System.setProperty("webdriver.chrome.driver", "**chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("http://localhost:8080/login");
}

@Test
public void test_login_page() {

    WebElement surname = driver.findElement(By.name("username"));
    surname.sendKeys("gmail@gmail.com");

    WebElement password = driver.findElement(By.name("password"));
    password.sendKeys("1");

    WebElement btn = driver.findElement(By.id("btn_login"));
    btn.click();

    String url = driver.getCurrentUrl();
    assertEquals(url, "http://localhost:8080/dashboard");
}

@After
public void when_the_test_ends() {
    driver.close();
}
}

Warning

Starting ChromeDriver 75.0.3770.140 
(2d9f97485c7b07dc18a74666574f19176731995c-refs/branch-heads/3770@{#1155}) on 
port 38921
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Peter Parker
  • 91
  • 1
  • 10

0 Answers0