Selenium: Disable Headless When Code Is Running? (python)
Solution 1:
No, it won't be possible to initialize google-chromeheadlessly and then make it visible to solve the captcha.
When you configure ChromeDriver using ChromeOptions()
to initiate headless in the process of initiating a new Chrome Browsing Session the configuration gets baked into the chromedriver executable and will persist till the lifetime of the WebDriver and remains uneditable. So you modify the ChromeOptions of the WebDriver instance which is currently in execution.
Even if you are able to extract the ChromeDriver and ChromeSession attributes e.g. Session ID, Cookies and other session attributes from the already initiated ChromeDriver and Chrome Browsing Session still you won't be able to change the set of attributes of the ChromeDriver.
A cleaner way would be to call driver.quit()
within tearDown(){}
method to close and destroy the current ChromeDriver and Chrome Browser instances gracefully and then span a new set of ChromeDriver and Chrome Browser instance with the new set of configurations.
- Selenium.common.exceptions.webdriverexception: Message: Invalid Argument: Value Must Be A Non-negative Integer With Chromedriver And Selenium
- Getting Data Inside A Google Chrome Indexeddb From Bash Or Python
- Webdriverexception: Message: Unknown Error: Chrome Failed To Start: Exited Abnormally With Chromedriver Chrome And Selenium On Debian Server
References
You can find a couple of relevant discussions in:
Post a Comment for "Selenium: Disable Headless When Code Is Running? (python)"