V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
woshichuanqilz
V2EX  ›  问与答

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

  •  
  •   woshichuanqilz · 2017-12-03 16:00:16 +08:00 · 2150 次点击
    这是一个创建于 2308 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用的是 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()
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5331 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 08:04 · PVG 16:04 · LAX 01:04 · JFK 04:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.