System setup:
- I used Python 3.10 in my setup.
- I used Selenium 4.
- I used the Python webdriver manager in my test setup. (https://pypi.org/project/webdriver-manager/)
- I used unittesting for some test pytest.
Details:
Currently, my test setup and the included test cases work under Chrome as a normal GUI call, and the test cases run through under those conditions.
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chrome_options)
class OpenDevcrowd(unittest.TestCase):
def setUp(self):
#self.driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()))
self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
self.driver.implicitly_wait(30)
self.base_url = "https://www.google.com/"
self.verificationErrors = []
self.accept_next_alert = True
I have used the options from 2020/2021 to change my setup to headless.
I tried the following information from stackoverflow in my build, but had no success with it at all:
- webdriver-manager not using proxy in order to update
- Running Selenium with Headless Chrome Webdriver
Issue:
It seems that the options (and I tried almost all the options from the information already found in stackoverflow) would not work anymore?
Only the GUI is still called, and the headless option is simply not used.
Questions:
Did the command range change somehow from 2020/21 to 2022?
Is it the webdriver manager that prevents the options from being called?
CodePudding user response:
--headless should come with --window-size
Ex: "--window-size=1920,1080"