Creating a python script for selenium testing -


i using docker set selenium testing environment. far have downloaded , installed: selenium/hub, selenium/node-chrome , selenium/node-firefox.

once started can see hub , nodes running @ 192.168.99.100:4444
far good.

i using official python image create test container. dockerfile:

from python:latest   maintainer mynanme   run pip install selenium   copy    . /usr/src   workdir /usr/src   entrypoint bash   

i have recorded python script through ide , trying 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 problem script doesnt work. when run 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 not callable

did miss install something?

from http://selenium-python.readthedocs.org/getting-started.html#using-selenium-to-write-tests

import unittest selenium import webdriver selenium.webdriver.common.keys import keys  class pythonorgsearch(unittest.testcase):      def setup(self):         self.driver = webdriver.firefox()      def test_search_in_python_org(self):         driver = self.driver         driver.get("http://www.python.org")         self.assertin("python", driver.title)         elem = driver.find_element_by_name("q")         elem.send_keys("pycon")         elem.send_keys(keys.return)         assert "no results found." not in driver.page_source       def teardown(self):         self.driver.close()  if __name__ == "__main__":     unittest.main() 

Comments