How do I use the HtmlUnit driver with Selenium through the Python bindings?

后端 未结 4 1217
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 08:41

I\'m using WebDriver through the Python bindings located on Google\'s site. According to the documentation here, it supports four browsers: Chrome, IE, Firefox, and HtmlUnit.

4条回答
  •  别那么骄傲
    2021-02-01 08:58

    HtmlUnit is a Java library so the only choice for non-java WebDriver bindings is to use a RemoteWebDriver. You will need to start a Selenium Server and connect to it specifying the HtmlUnit as desired browser.

    I am not very familiar with Python, but according to http://code.google.com/p/selenium/wiki/PythonBindings it should look something like:

    from selenium.remote import connect
    from selenium import HTMLUNIT
    
    
    wd = connect(HTMLUNIT, server="http://:4444")
    

提交回复
热议问题