I am using the python client for browsermob to record traffic of my selenium tests. Selenium grid is in a docker container with images for chrome and firefox. I cant seem to configure the docker images properly to connect to the proxy and the grid. Here is the code that I use to create the proxy and the remote web driver:
server = browsermobproxy.Server('mylocalpathtobrowsermobbin')
server.start()
proxy = server.create_proxy()
proxy.new_har()
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities={
'browserName': 'chrome',
'chromeOptions': {
'args': ["--proxy-server={}".format(proxy.proxy)]}
})
And this is my docker-compose file:
hub:
image: selenium/hub
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug
volumes:
- /dev/shm:/dev/shm
links:
- hub
ports:
- "5900:5900"
I am new to docker, I understand that I need to expose the port that the proxy uses to connect but I cannot get it working. Any help is appreciated, thanks!