My AUT runs in a docker container and the URL for it is "http://localhost:8080/" . Now when I trigger the tests using Zalenium it launches the browser but when it tries to navigate to the AUT's URL it can't find it. Is it because my AUT runs in a docker container and Zalenium also runs in a separate docker container and they both can't communicate with each other?
Thanks in Advance.
I think that's how it supposed to work. You ideally want contains to have isolation until you say otherwise.
A quick solution, on your selenium scripts, instead of
localhostspecify your<machine name>. That way, your scripts in zalenium will look to resolve the address through the network (which is still you) instead of trying to internally resolve localhost on their own network ring.While this will probably work for you machine, it's a little bit static. You'll probably want to script it as part of your solution so it connects to multiple.
In java you can use this to get the running machine name:
Alternatively, to make a more portable solution, you might want to review the docker networking pages.
I think this tutorial might help you. "Networking with standalone containers" sounds about right.
Long and short of it is when you run your docker containers you need to attach them to the same network. The default is:
Or create your own bridge:
and run both your containers on that bridge name: