'How to bring browser to front and maximize using Selenium Python
I am working on automating a section of data entry using a mixture of Selenium and Pyautogui.
I have the manual automated part down using the module Pyautogui but I need to bring the browser to the front so the mouse and keyboard can interact with the browser.
All the solutions I've tried maximizes the window but it stays in the background.
Solution 1:[1]
Try the below
from selenium import webdriver
driver = webdriver.Chrome()
driver.switch_to.window(driver.current_window_handle)
Solution 2:[2]
To bring the browser to frontground and maximize using Selenium and Python you can use the following set of lines:
driver.execute_script("window.focus();")
driver.maximize_window()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Akzy |
| Solution 2 | undetected Selenium |
