Closed AnatoliiHanziuk closed 8 months ago
@AnatoliiHanziuk I would suggest using Chrome Developer Tools Protocol to mock responses inside the browser. https://github.com/aerokube/chrome-developer-tools-protocol-java-example/blob/master/src/test/java/com/aerokube/selenoid/ChromeDevtoolsTest.java#L171
@vania-pooh , it's a good idea I also had in my mind but in this case I'm limiting the selection of the browsers. At least until Firefox adds the suport of CDP. Also proposed solution works quite well if everything is on localhost. In case of the remote execution the problem is similar - you need to know the address of the browser in advance to initiate web socket session.
I thought that the problem I have should be quite common (people execute their tests on CircleCI, TravicCI, GitlabCI, etc) and there should be an easy way to establish visibility between the place of the test execution, proxy and browser in Selenoid container started on the different host.
@AnatoliiHanziuk I would ask in Selenide support then.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It's not an issue but a question on how to connect Selenoid and Selenide and proxy running on remote hosts.
I have the setup where the tests are executed as a part of AWS CodePipeline during the CodeBuild stage. It means that I don't control the instances where the execution on CodeBuild step happens and I cannot adjust the network settings there. Tests are executed inside the Docker container.
I use Selenide to start the proxy server and specify these properties
I want the responses sent by the server of my application to be intercepted and overridden by the proxy to see the same pre-defined data in the browser during each execution of the test.
The browser should be able to access the host with the proxy to receive stubbed responses.
Which value do I need to specify for the
Configuration.proxyHost
in this setup?If I specify, for example,
InetAddress.getLocalHost().getHostAddress();
ornew NetweorkUtils().getNotLoopbackAddressOfThisMachine()
I receiveThe site cannot be reached. ERR_TIMED_OUT
error in the browser. So it looks like the browser is trying to connect the proxy server to pass the command through it but it doesn't have access to proxy.