Chrome Headful Mode
PSA supports Chrome Headful mode in Chrome agent with PyAutoGUI.
To run the Chrome browser in Headful mode:
| Component | Action |
|---|---|
docker-psa |
Set the startHeadfulDisplay flag in the application-onprem.yml file to true. |
kubernetes-psa |
Set the startHeadfulDisplay flag in the values.yaml file to true. |
This following script is an example of an automation test to simulate a user typing credentials into the GitHub login page:
import time
import pyautogui
pageUrl = "https://github.com/login"
driver.get(pageUrl)
try:
print(f"PyAutoGUI {pyautogui.__version__} imported OK")
time.sleep(3)
# Explicitly focus username field using Selenium
username_input = driver.find_element("id", "login_field")
username_input.click()
print("Username field focused")
# Type username
pyautogui.write("test.user@example.com", interval=0.05)
print("Typed username")
# Move to password field
pyautogui.press("tab")
print("Focused password field")
# Type password (dummy)
pyautogui.write("DummyPassword123!", interval=0.05)
print("Typed password")
# DO NOT submit
print("Login NOT submitted")
print("PyAutoGUI Keyboard Form Test: PASSED")
except Exception as e:
print(f"PyAutoGUI Keyboard Form Test: FAILED - {e}")
time.sleep(5)
assert "Sign in to GitHub" in driver.title