zoukankan      html  css  js  c++  java
  • linux上虚拟显示器和火狐浏览器的使用学习记录

    Ubuntu 14.04

      sudo apt-get firefox

    sudo apt-get install python-pip
    sudo apt-get install xvfb
    # xserver-xephyr vnc4server sudo pip install pyvirtualdisplay # 可选 sudo apt-get install python-pil scrot sudo pip install pyscreenshot # optional for examples sudo pip install entrypoint2

    测试程序

    from pyvirtualdisplay import Display
    from selenium import webdriver

    display = Display(visible=0, size=(800, 600))
    display.start()
    browser = webdriver.Firefox(executable_path=r'/usr/bin/firefox')
    browser.get('https://www.baidu.com')
    print browser.title
    browser.quit()
    display.stop()

    输出

    百度一下,你就知道

    ubuntu下还需要下载geckodriver放在/usr/bin

    PyVirtualDisplay官方文档https://pypi.python.org/pypi/PyVirtualDisplay

  • 相关阅读:
    Sublime 设置移动光标快捷键
    Reverse Linked List II
    Reverse Nodes in K-Group
    Sort Colors
    Swap Nodes in Pairs
    Intersection of Two Linked Lists
    Word Break
    Unique Binary Search Tree
    Maximal Square
    Happy Number
  • 原文地址:https://www.cnblogs.com/lgh344902118/p/6269171.html
Copyright © 2011-2022 走看看