• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Can't execute test with Spring Boot and Selenium on random port

 
Ranch Hand
Posts: 30
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
I'm writing a very simple test of a web application using Spring Boot and Selenium. Here is the code:



But the test always fails. The two println sentences show that the baseUrl is http://localhost:0 and the title is an empty string.
Is it correct that random port is 0? It sounds me strange, in fact the title is the empty string, but running the app "normally" (not as test) I can see that the title is "Login".
 
Stefano Carniel
Ranch Hand
Posts: 30
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For all people having the same issue, the problem is in the declaration of the port variable. Static field are not supported, removing the qualifier solved the problem.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic