This sample project is intended to create browser logs for the executed script. For simplicity have written small script to run on Firefox and Chrome driver and used gradle as a build tool.
Currently, For the local exection with: driver = new FirefoxDriver(....); The driver is able to run the script and create a log file under target/deviceLogs directory with the logs properly mentioned into it.
But, When the script is ran on docker container with: driver = new RemoteWebDriver(....); The driver is able to run the script but the log file under target/deviceLogs directory is not getting created and populated. This behaviour is being observed on browsers like firefox, chrome, safari
- docker-compose.yml file having specified service which needs to be run on docker
- browser_config.json file having firefox browser configuration
- Setup class setting up driver manager, setting log file and getting firefox options
- BrowserLogDemo class having script written into it
- Target/deviceLogs directory, here log file gets created with logs into it
- Clone the project to your local workspace
- To pull the image and run the container on docker Run the command on terminal docker-compose up
- In BrowserLogDemo class on line 28, If want to execute script on docker make boolean variable executeOnDocker to true if want to execute script on local make boolean variable executeOnDocker to false
- Delete if any log file is present in deviceLogs directory
- Run the script
- Project run on intel chip for mac
Use command on terminal to run the particular test
for firefox test:
./gradlew clean test --tests "BrowserLogDemo.browserLogOnFirefox"
for chrome test:
./gradlew clean test --tests "BrowserLogDemo.browserLogOnChrome"
After executing the script, log file name firefox.log file gets created at deviceLogs directory when ran on local But file does not get created when ran on docker
Need Solution on it to resolve this issue