unable to call firefox from selenium in python on AWS machine

前端 未结 4 439
别那么骄傲
别那么骄傲 2020-11-28 23:17

I am trying to use selenium from python to scrape some dynamics pages with javascript. However, I cannot call firefox after I followed the instruction of selenium on the pyp

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 23:20

    This is already in the comment of OP's question, but to lay it out as an answer. You can have Selenium run in the background without opening an actual browser window.

    For example, if you use Chrome, set these options:

    from selenium.webdriver.chrome.options import Options
    chrome_options = Options()
    chrome_options.set_headless(headless=True)
    

    Then when you call your web driver, your settings become a parameter:

    browser = webdriver.Chrome(chrome_options=chrome_options)
    

提交回复
热议问题