selenium ide 生成的 Python 代码无法执行是怎么回事?

2017-12-03 16:00:16 +08:00
 woshichuanqilz

用的是 firefox 的 selenium ide 我随便测试一个代码就是点开了一个连接然后生成下面的代码但是无法运行,

提示ImportError: cannot import name 'selenium' 感觉是很老的代码了, 这个代码应该怎么处理才能正常的使用?

# -*- coding: utf-8 -*-
# from selenium import selenium
import selenium
import unittest, time, re

class test(unittest.TestCase):
    def setUp(self):
        self.verificationErrors = []
        self.selenium = selenium("localhost", 4444, "*chrome", "https://github.com/")
        self.selenium.start()

    def test_test(self):
        sel = self.selenium
        sel.open("/SeleniumHQ/selenium/wiki/SeIDEReleaseNotes")
        sel.click("link=exact:http://blog.reallysimplethoughts.com/2015/03/09/selenium-ide-scheduler-has-arrived-part-1/")
        sel.wait_for_page_to_load("30000")

    def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":
    unittest.main()
2164 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/411579

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX