Python selenium error:TypeError: 'module' object is not callable
从Selenium IDE里export test case as Python 2/unittest/Remote Control导出python的脚本如下:# -*- coding: utf-8 -*-
from selenium import selenium
import unittest, time, re
class remote_python_baidu(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*chrome", "https://www.baidu.com/")
self.selenium.start()
def test_remote_python_baidu(self):
sel = self.selenium
sel.open("/")
sel.click("id=kw")
sel.type("id=kw", "python")
sel.click("id=su")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
在Python里执行总报错:
E
======================================================================
ERROR: test_remote_python_baidu (__main__.remote_python_baidu)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\auto_test\remote_python_baidu.py", line 8, in setUp
self.selenium = selenium("localhost", 4444, "*chrome", "https://www.baidu.com/")
TypeError: 'module' object is not callable
----------------------------------------------------------------------
Ran 1 test in 0.020s
FAILED (errors=1)
请问是什么原因引起的?
为什么还有selenium 1.0,用selenium 2.0多好
页:
[1]