简体   繁体   中英

Selenium - IE not running headless

Using python and selenium, I have a function for IE to run headless, but for some reason it's not working. It works perfect for Chrome, but not IE. I could've sworn it worked previously. Any ideas?

from selenium import webdriver
from selenium.webdriver.ie.options import Options as IEOptions

def openie():
    setglobalvariables()
    window_size = '1920,1080'
    ie_options = IEOptions()
    ie_options.add_argument('--headless')
    ie_options.add_argument('--window-size=%s' % window_size)
    ie_options.add_argument('--no-sandbox')
    driver = webdriver.Ie(input_path + 'IEDriverServer.exe', options=ie_options)

    url = settingsfile('url').strip()
    statusmessage(url)
    driver.get(url)
    driver.maximize_window()
    driver.implicitly_wait(3)

    return driver

As far as I know, IE does not support Headless Browsing.

You can refer to this thread for verification and a workaround on how it can work:

The IE driver does not support execution without an active, logged-in desktop session running. You'll need to take this up with the author of the solution you're using to achieve "headless" (scare quotes intentional) execution of IE.

https://github.com/SeleniumHQ/selenium/issues/4551#issuecomment-324319508

https://community.lambdatest.com/t/how-can-i-run-my-selenium-tests-in-headless-ie/5447


EDIT:

The second thread is of the LambdaTest community and answered by me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM