Skip to content

Commit

Permalink
fixes #122 (#123)
Browse files Browse the repository at this point in the history
* fixes #122

* fixes #122
  • Loading branch information
shikhar08 authored Dec 8, 2020
1 parent 70055bc commit f5113fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions testcontainers/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class BrowserWebDriverContainer(DockerContainer):
"""
def __init__(self, capabilities, image=None):
self.capabilities = capabilities
if not image:
self.image = get_image_name(capabilities)
self.image = image or get_image_name(capabilities)
self.port_to_expose = 4444
self.vnc_port_to_expose = 5900
super(BrowserWebDriverContainer, self).__init__(image=self.image)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_selenium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

def test_selenium_custom_image():
from testcontainers.selenium import BrowserWebDriverContainer
from selenium.webdriver import DesiredCapabilities

image = "selenium/standalone-chrome:latest"
chrome = BrowserWebDriverContainer(DesiredCapabilities.CHROME, image=image)
assert "image" in dir(chrome), "`image` attribute was not instantialized."
assert chrome.image == image, "`image` attribute was not set to the user provided value"

0 comments on commit f5113fb

Please sign in to comment.