{"id":16151264,"url":"https://github.com/njasm/marionette_client","last_synced_at":"2025-04-09T15:05:19.996Z","repository":{"id":3726265,"uuid":"50467678","full_name":"njasm/marionette_client","owner":"njasm","description":"Mozilla's Gecko Marionette client in golang","archived":false,"fork":false,"pushed_at":"2025-03-28T19:34:25.000Z","size":292,"stargazers_count":53,"open_issues_count":7,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T15:05:09.993Z","etag":null,"topics":["firefox","golang","marionette","marionette-client","mozilla-firefox","selenium","selenium-webdriver","webdriver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/njasm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-26T23:49:25.000Z","updated_at":"2025-03-28T14:07:49.000Z","dependencies_parsed_at":"2024-12-26T08:11:40.528Z","dependency_job_id":"c36ced32-7123-4c71-8558-54f1cf4a38a2","html_url":"https://github.com/njasm/marionette_client","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njasm%2Fmarionette_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njasm%2Fmarionette_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njasm%2Fmarionette_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njasm%2Fmarionette_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/njasm","download_url":"https://codeload.github.com/njasm/marionette_client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firefox","golang","marionette","marionette-client","mozilla-firefox","selenium","selenium-webdriver","webdriver"],"created_at":"2024-10-10T00:55:29.768Z","updated_at":"2025-04-09T15:05:19.978Z","avatar_url":"https://github.com/njasm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/marionette_client.svg)](https://pkg.go.dev/github.com/njasm/marionette_client)\n[![CI](https://github.com/njasm/marionette_client/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/njasm/marionette_client/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/njasm/marionette_client/badge.svg?branch=master)](https://coveralls.io/github/njasm/marionette_client?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/njasm/marionette_client)](https://goreportcard.com/report/github.com/njasm/marionette_client)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://choosealicense.com/licenses/mit/)\n\n# marionette_client\nMozilla's Gecko Marionette client in golang\n\n## What is Marionette\n\"Marionette is an automation driver for Mozilla's Gecko engine. It can remotely control either the UI, or the internal \nJavaScript of a Gecko platform, such as Firefox. It can control both the chrome (i.e. menus and functions) or the content \n(the webpage loaded inside the browsing context), giving a high level of control and ability to replicate user actions. \nIn addition to performing actions on the browser, Marionette can also read the properties and attributes of the DOM.\n\nIf this sounds similar to Selenium/WebDriver then you're correct! Marionette shares much of the same ethos and API as \nSelenium/WebDriver, with additional commands to interact with Gecko's chrome interface. Its goal is to replicate what \nSelenium does for web content: to enable the tester to have the ability to send commands to remotely control a user agent.\" \n\n## Resources\nhttps://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette \n\nhttps://w3c.github.io/webdriver/webdriver-spec.html\n\n## Examples\nIncomplete list. Check the tests for more examples.\n\n#### Instantiate the client\n```go\nclient := NewClient()\n// this are the default marionette values for hostname, and port \nclient.Connect(\"\", 0)\n// let marionette generate the Session ID with it's default Capabilities\nclient.NewSession(\"\", nil) \n\t\n```\n\n#### Navigate to page\n```go\nclient.Navigate(\"http://www.google.com/\")\n```\n\n#### Change Contexts\n```go\nclient.SetContext(Context(CHROME))\n// or\nclient.SetContext(Context(CONTENT))\n\t\n```\n\n#### Find Element\n```go\nelement, err := client.FindElement(By(ID), \"html-element-id-attribute\")\nif err != nil {\n\t// handle your errors\n}\n\n// else\nprintln(element.Id())\nprintln(element.Enabled())\nprintln(element.Selected())\nprintln(element.Displayed())\nprintln(element.TagName())\nprintln(element.Text())\nprintln(element.Attribute(\"id\"))\nprintln(element.Property(\"id\"))\nprintln(element.CssValue(\"text-decoration\"))\n\t\n// width, height, x and y\nrect, err := element.Rect()\nif err != nil {\n    // handle your errors\n}\n\nfmt.Printf(\"%#v\", rect)\n\t\n// size\nw, h, err := element.Size()\nif err != nil {\n\t// handle your errors\n}\n\nfmt.Printf(\"width: %f, height: %f\", w, h)\n\n//location\nx, y, err := element.Location()\nif err != nil {\n    // handle your errors\n}\n\nfmt.Printf(\"x: %v, y: %v\", x, y)\n```\n\n#### Find Elements\n```go\ncollection, err := element.FindElements(By(TAG_NAME), \"li\")\nif err != nil {\n\t// handle your errors\n}\n\n// else\nfor var e := range collection {\n\tprintln(e.Id())\n   \tprintln(e.Enabled())\n   \tprintln(e.Selected())\n   \tprintln(e.Displayed())\n   \tprintln(e.TagName())\n   \tprintln(e.Text())\n   \tprintln(e.Attribute(\"id\"))\n   \tprintln(e.CssValue(\"text-decoration\"))\n   \te.Click()\n}\n```\n\n#### Execute JS Script\n```go\nscript := \"function mySum(a, b) { return a + b; }; return mySum(arguments[0], arguments[1]);\"\nargs := []int{1, 3} // arguments to be passed to the function\ntimeout := 1000     // milliseconds\nsandbox := false    // new Sandbox\nr, err := client.ExecuteScript(script, args, timeout, sandbox)\nif err == nil {\n    println(r.Value) // 4 \n}\n```\n\n#### Wait(), Until() Expected condition is true.\n```go\nclient.Navigate(\"http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_get\")\n\ntimeout := time.Duration(10) * time.Second\ncondition := ElementIsPresent(By(ID), \"stackH\")\nok, webElement, err := Wait(client).For(timeout).Until(condition)\n\nif !ok {\n\tlog.Printf(\"%#v\", err)\n\t// do your error stuff\n\treturn\n}\n\n// cool, we've the element, let's click on it!\nwebElement.Click()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjasm%2Fmarionette_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnjasm%2Fmarionette_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjasm%2Fmarionette_client/lists"}