bump
This commit is contained in:
@@ -325,6 +325,41 @@ func (c *Client) UploadFile(tabID, selector, filePath string, selectionTimeout,
|
||||
return nil
|
||||
}
|
||||
|
||||
// SelectElement selects an option in a select dropdown
|
||||
// If tabID is empty, the current tab will be used
|
||||
// selectionTimeout and actionTimeout are in seconds, 0 means no timeout
|
||||
func (c *Client) SelectElement(tabID, selector, value string, selectionTimeout, actionTimeout int) error {
|
||||
params := map[string]string{
|
||||
"selector": selector,
|
||||
"value": value,
|
||||
}
|
||||
|
||||
// Only include tab ID if it's provided
|
||||
if tabID != "" {
|
||||
params["tab"] = tabID
|
||||
}
|
||||
|
||||
// Add timeouts if specified
|
||||
if selectionTimeout > 0 {
|
||||
params["selection-timeout"] = strconv.Itoa(selectionTimeout)
|
||||
}
|
||||
|
||||
if actionTimeout > 0 {
|
||||
params["action-timeout"] = strconv.Itoa(actionTimeout)
|
||||
}
|
||||
|
||||
resp, err := c.SendCommand("select-element", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !resp.Success {
|
||||
return fmt.Errorf("failed to select element: %s", resp.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SubmitForm submits a form
|
||||
// If tabID is empty, the current tab will be used
|
||||
// selectionTimeout and actionTimeout are in seconds, 0 means no timeout
|
||||
|
Reference in New Issue
Block a user