testcontainers-java
testcontainers-java copied to clipboard
Selenium docs suggest deprecated `getTestHostIpAddress()` instead of host exposing mechanism
Trying to get my Selenium WebDriver testcontainer up, I get the following error when I try to get the host's port using getTestHostIpAddress()
:
Caused by: java.lang.UnsupportedOperationException: getTestHostIpAddress() is only implemented for docker-machine right now
I am running this on Ubuntu 20.04
Any ideas?
Have a look at https://www.testcontainers.org/features/networking/#exposing-host-ports-to-the-container
Here is an example: https://github.com/testcontainers/testcontainers-java/blob/master/examples/selenium-container/src/test/java/SeleniumContainerTest.java
Thanks, looks like it works. Maybe the documentation should reflect this?
uh? 😅 Wasn't that a link to the documentation?
lol I meant to the Webdriver docs, they just have you use getTestHostIpAddress()
Ah, great point, thank you! Would you like to contribute a fix? :)
Here is the file: https://github.com/testcontainers/testcontainers-java/blob/master/docs/modules/webdriver_containers.md
While I'm at it, did we want to add an additional bit on recording? Like the fact recording doesn't seem to happen outside of the following context:
@Container/@Rule
public BrowserWebDriverContainer ...
You are right, currently automatic recording based on failed tests only works in conjunction with the JUnit4 or JUnit5 module. However, you can manually trigger the saving of the recording by calling afterTest(TestDescription description, Optional<Throwable> throwable)
on the container object.
I think clarifying this in the docs would be great 👍
Thanks! I'll look at getting that in too. Happen to know how to get those parameters in the context of an @AfterEach
for example?
It sees like the latest docs do not suggest usage of getTestHostIpAddress()
and instead suggest usage of the host exposing mechanism: https://www.testcontainers.org/modules/webdriver_containers/
I think this issue can be closed.
@REslim30 You are right, thanks for letting us know.