Selenium-Python Client Library - Automating in Background

后端 未结 2 728
一个人的身影
一个人的身影 2021-01-05 13:21

I am trying automate a login process to my web application using Selenium-Python Client Library. The ultimate goal is to learn Selenium\'s Python Client Library. So, I would

相关标签:
2条回答
  • 2021-01-05 13:49

    Firefox (and other graphical browsers) require an X display. You can use a virtual one with the help of PyVirtualDisplay:

    from pyvirtualdisplay import Display
    display = Display(visible=0, size=(1024, 768))
    display.start()
    
    browser = webdriver.Firefox()
    ... more selenium code ...
    
    display.stop()
    

    Apart from PyVirtualDisplay, you'll also need its dependencies xfvb and Xephyr (on debian: apt-get install -y xvfb xserver-xephyr)

    0 讨论(0)
  • 2021-01-05 13:50

    You can also use PhantomJS and Ghostdriver to run Selenium without a GUI-based browser.

    https://github.com/detro/ghostdriver

    0 讨论(0)
提交回复
热议问题