简体   繁体   中英

Can't run cucumber/selenium with chrome

I try to test a selfmade local website with a local server, but it don't work... I get some erroor message:

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"Amount"}
  (Session info: chrome=70.0.3538.102)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

But I define the elements:

protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
{
    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().println(
            "<html><head><title>HEADLINE</title></head>" +
                    "<body><form action=\"/withdraw\" method=\"post\">" +
                    "<label for=\"amount\">Amount</label>" +
                    "<input type=\"text\" id=\"amount\" name=\"amount\">" +
                    "<button type=\"submit\" id=\"withdraw\">Withdraw</button>" +
                    "</form></body></html>");
}

But I dont get the headline or anything else... in Chrome the url is: data:, And I get a blank page

Oh... What a stupid mistake... Thank u!

I get now this massege: java.lang.AssertionError: Incorrect amount dispensed - expected:<20> but was:<0>
    at org.junit.Assert.fail(Assert.java:88)

But thats not surprising. But Istill can't see my "website" in Chrome. While I run the test, 3 windows of chrome are opening. One with my desired result, but it is closed after a millisecond...So I can't really see my desired result. At the end ther is only the window with the url: data:, An a blank page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM