Selenium/PhantomJS raises error

前端 未结 4 2097
谎友^
谎友^ 2020-12-15 10:55

I\'m trying to run PhantomJS driver in Python but I\'m getting error. I\'ve read that I should pass the whole path as an argument but it di

4条回答
  •  离开以前
    2020-12-15 11:35

    For me, this works fine and also don't have to specify path for PhantomJS You need to install pip install phantomjs-binary binary package using pip

    pip install phantomjs-binary
    

    it will download a package of approx 60MB. and contains PhantomJS for windows, mac, and Linux as per the running environment. after that, you can use it

    from selenium import webdriver
    from phantomjs_bin import executable_path
    
    driver = webdriver.PhantomJS(executable_path=executable_path)
    

提交回复
热议问题