V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
woshichuanqilz
V2EX  ›  问与答

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

  •  
  •   woshichuanqilz · Dec 3, 2017 · 2639 views
    This topic created in 3081 days ago, the information mentioned may be changed or developed.

    用的是 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()
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3422 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:26 · PVG 19:26 · LAX 04:26 · JFK 07:26
    ♥ Do have faith in what you're doing.