accessibility

This commit is contained in:
Josh at WLTechBlog
2025-08-29 12:11:54 -05:00
parent 6bad614f9e
commit 7f4d8b8e84
12 changed files with 2708 additions and 1577 deletions

24
main.go
View File

@@ -53,8 +53,7 @@ func main() {
fillFormTabID := fillFormCmd.String("tab", "", "Tab ID to fill form in (optional, uses current tab if not specified)")
fillFormSelector := fillFormCmd.String("selector", "", "CSS selector for the input field")
fillFormValue := fillFormCmd.String("value", "", "Value to fill in the form field")
fillFormSelectionTimeout := fillFormCmd.Int("selection-timeout", 5, "Timeout in seconds for finding the element")
fillFormActionTimeout := fillFormCmd.Int("action-timeout", 5, "Timeout in seconds for the fill action")
fillFormTimeout := fillFormCmd.Int("timeout", 5, "Timeout in seconds for the fill operation")
fillFormHost := fillFormCmd.String("host", "localhost", "Daemon host")
fillFormPort := fillFormCmd.Int("port", 8989, "Daemon port")
@@ -62,16 +61,14 @@ func main() {
uploadFileTabID := uploadFileCmd.String("tab", "", "Tab ID to upload file in (optional, uses current tab if not specified)")
uploadFileSelector := uploadFileCmd.String("selector", "", "CSS selector for the file input")
uploadFilePath := uploadFileCmd.String("file", "", "Path to the file to upload")
uploadFileSelectionTimeout := uploadFileCmd.Int("selection-timeout", 5, "Timeout in seconds for finding the element")
uploadFileActionTimeout := uploadFileCmd.Int("action-timeout", 5, "Timeout in seconds for the upload action")
uploadFileTimeout := uploadFileCmd.Int("timeout", 5, "Timeout in seconds for the upload operation")
uploadFileHost := uploadFileCmd.String("host", "localhost", "Daemon host")
uploadFilePort := uploadFileCmd.Int("port", 8989, "Daemon port")
// submit-form flags
submitFormTabID := submitFormCmd.String("tab", "", "Tab ID to submit form in (optional, uses current tab if not specified)")
submitFormSelector := submitFormCmd.String("selector", "", "CSS selector for the form")
submitFormSelectionTimeout := submitFormCmd.Int("selection-timeout", 5, "Timeout in seconds for finding the element")
submitFormActionTimeout := submitFormCmd.Int("action-timeout", 5, "Timeout in seconds for the submit action")
submitFormTimeout := submitFormCmd.Int("timeout", 5, "Timeout in seconds for the submit operation")
submitFormHost := submitFormCmd.String("host", "localhost", "Daemon host")
submitFormPort := submitFormCmd.Int("port", 8989, "Daemon port")
@@ -84,15 +81,14 @@ func main() {
// get-element flags
getElementTabID := getElementCmd.String("tab", "", "Tab ID to get element from (optional, uses current tab if not specified)")
getElementSelector := getElementCmd.String("selector", "", "CSS selector for the element")
getElementSelectionTimeout := getElementCmd.Int("selection-timeout", 5, "Timeout in seconds for finding the element")
getElementTimeout := getElementCmd.Int("timeout", 5, "Timeout in seconds for finding the element")
getElementHost := getElementCmd.String("host", "localhost", "Daemon host")
getElementPort := getElementCmd.Int("port", 8989, "Daemon port")
// click-element flags
clickElementTabID := clickElementCmd.String("tab", "", "Tab ID to click element in (optional, uses current tab if not specified)")
clickElementSelector := clickElementCmd.String("selector", "", "CSS selector for the element to click")
clickElementSelectionTimeout := clickElementCmd.Int("selection-timeout", 5, "Timeout in seconds for finding the element")
clickElementActionTimeout := clickElementCmd.Int("action-timeout", 5, "Timeout in seconds for the click action")
clickElementTimeout := clickElementCmd.Int("timeout", 5, "Timeout in seconds for the click operation")
clickElementHost := clickElementCmd.String("host", "localhost", "Daemon host")
clickElementPort := clickElementCmd.Int("port", 8989, "Daemon port")
@@ -213,7 +209,7 @@ func main() {
c := client.NewClient(*fillFormHost, *fillFormPort)
// Fill the form field
err := c.FillFormField(*fillFormTabID, *fillFormSelector, *fillFormValue, *fillFormSelectionTimeout, *fillFormActionTimeout)
err := c.FillFormField(*fillFormTabID, *fillFormSelector, *fillFormValue, *fillFormTimeout)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
@@ -248,7 +244,7 @@ func main() {
fmt.Printf("File transferred to container: %s\n", containerPath)
// Then upload the file to the web form using the container path
err = c.UploadFile(*uploadFileTabID, *uploadFileSelector, containerPath, *uploadFileSelectionTimeout, *uploadFileActionTimeout)
err = c.UploadFile(*uploadFileTabID, *uploadFileSelector, containerPath, *uploadFileTimeout)
if err != nil {
fmt.Fprintf(os.Stderr, "Error uploading file to web form: %v\n", err)
os.Exit(1)
@@ -268,7 +264,7 @@ func main() {
c := client.NewClient(*submitFormHost, *submitFormPort)
// Submit the form
err := c.SubmitForm(*submitFormTabID, *submitFormSelector, *submitFormSelectionTimeout, *submitFormActionTimeout)
err := c.SubmitForm(*submitFormTabID, *submitFormSelector, *submitFormTimeout)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
@@ -304,7 +300,7 @@ func main() {
c := client.NewClient(*getElementHost, *getElementPort)
// Get the element HTML
html, err := c.GetElementHTML(*getElementTabID, *getElementSelector, *getElementSelectionTimeout)
html, err := c.GetElementHTML(*getElementTabID, *getElementSelector, *getElementTimeout)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
@@ -325,7 +321,7 @@ func main() {
c := client.NewClient(*clickElementHost, *clickElementPort)
// Click the element
err := c.ClickElement(*clickElementTabID, *clickElementSelector, *clickElementSelectionTimeout, *clickElementActionTimeout)
err := c.ClickElement(*clickElementTabID, *clickElementSelector, *clickElementTimeout)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)