I am using docker to set up a selenium testing environment. So far i have successfully downloaded and installed: selenium/hub, selenium/node-chrome and selenium/node-firefox.
Once started i can see the hub and the nodes running at 192.168.99.100:4444
So far so good.
I am then using the official python image to create a test container. This is my dockerfile:
FROM python:latest
MAINTAINER mynanme
RUN pip install selenium
COPY . /usr/src
WORKDIR /usr/src
ENTRYPOINT bash
I have also recorded a python script through the IDE and i am then trying to run it:
from selenium import selenium
import unittest, time, re
class test2(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("http://192.168.99.100", 4444, "*chrome", "https://www.google.at/")
self.selenium.start()
def test_test2(self):
sel = self.selenium
sel.open("/?gws_rd=ssl")
sel.type("id=lst-ib", "test2")
sel.click("name=btnG")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
The only problem is that this script just doesnt work. When i run it get the following error:
Traceback (most recent call last):
File "testRC.py", line 8, in setUp
self.selenium = selenium("http://192.168.99.100", 4444, "*chrome", "https://www.google.at/")
TypeError: 'module' object is not callable
Did i miss to install something?
https://windsooon.github.io/2017/06/14/How%20to%20use%20selenium%20with%20docker/
– Windsooon