I am looking for a solution to open the chrome browser with selenium in headless mode, do some actions and then switch within the same browser in normal
mode.
For example:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("headless")
browser = webdriver.Chrome('C:/chromedriver', options=chrome_options)
browser.get("https://www.google.de/")
# Do some actions in headless mode
browser.find_element_by_css_selector("#L2AGLb > div").click()
browser.find_element_by_css_selector("body > div.L3eUgb > div.o3j99.ikrT4e.om7nvf > form > div:nth-child(1) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input").send_keys("Python rocks")
browser.find_element_by_css_selector("body > div.L3eUgb > div.o3j99.ikrT4e.om7nvf > form > div:nth-child(1) > div.A8SBwf > div.FPdoLc.lJ9FBc > center > input.gNO89b").send_keys(Keys.ENTER)
# Open Browser
Is there a way to do this?