diff --git a/.gitignore b/.gitignore index a9417c2..68bc537 100644 --- a/.gitignore +++ b/.gitignore @@ -217,3 +217,5 @@ cython_debug/ .pypirc __debug* + +locator_log.json \ No newline at end of file diff --git a/examples/appium/main.go b/examples/appium/main.go index ed7896b..78c995c 100644 --- a/examples/appium/main.go +++ b/examples/appium/main.go @@ -2,14 +2,18 @@ package main import ( "fmt" + "log/slog" "os" locatr "github.com/vertexcover-io/locatr/golang" appiumLocatr "github.com/vertexcover-io/locatr/golang/appium" "github.com/vertexcover-io/locatr/golang/llm" + "github.com/vertexcover-io/locatr/golang/logger" ) func main() { + logger.Level.Set(slog.LevelDebug) + llmClient, _ := llm.NewLlmClient( llm.OpenAI, // (openai | anthropic), os.Getenv("OPENAI_MODEL"), @@ -19,14 +23,14 @@ func main() { LlmClient: llmClient, } aLocatr, err := appiumLocatr.NewAppiumLocatr( - "https://device.pcloudy.com/appiumcloud/wd/hub", - "89ead025-4cf4-4c44-b723-feff1c3aa28f", bLocatr, + "http://localhost:4723", + "640daa1b-afdc-45a3-83fd-d0c37cffb3de", bLocatr, ) if err != nil { fmt.Println("failed creating appium locatr locatr", err) return } - desc := "This element is a textbox designed for user input, specifically for search queries. It is labeled for accessibility as \"Google Search\" and allows users to enter text. The textbox supports autocomplete features, enhancing the user experience by suggesting possible queries as the user types. It is configured to ignore capitalization and offers spell check capabilities. Additionally, it has a maximum length for input, ensuring submissions remain manageable. The role of the element is defined as a \"textbox,\" indicating its primary purpose for text entry." + desc := "This input element is designed for password entry, indicated by its type attribute set to \"password,\" which obscures the text entered for privacy. It requires user input, as denoted by the \"required\" attribute, ensuring that users do not submit the form without filling out this field. The placeholder text prompts users to \"Enter your password,\" guiding them on the expected input. This input is commonly used within forms where sensitive data is collected, such as registration or login forms." l, err := aLocatr.GetLocatrStr(desc) if err != nil { fmt.Println("error getting locatr", err) diff --git a/golang/logger/logger.go b/golang/logger/logger.go index faf6188..14d3f18 100644 --- a/golang/logger/logger.go +++ b/golang/logger/logger.go @@ -12,7 +12,11 @@ func newLogger() *slog.Logger { opts := &slog.HandlerOptions{ Level: Level, } - return slog.New(slog.NewJSONHandler(os.Stdout, opts)) + log_file, err := os.Create("locator_log.json") + if err != nil { + panic("failed to create log file") + } + return slog.New(slog.NewJSONHandler(log_file, opts)) } var Logger = newLogger() diff --git a/pyproject.toml b/pyproject.toml index 0bb9d0f..6c5bc56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ exclude = [ [project] name = "test_locatr" -version = "0.38.0" +version = "0.40.0" description = "Get HTML/XML elements css/xpath selectors using natural language." readme = "python_client/README.md" requires-python = ">=3.9"