{"id":23651926,"url":"https://github.com/microfocus/robodriver","last_synced_at":"2025-11-16T20:30:14.613Z","repository":{"id":56309645,"uuid":"92404633","full_name":"MicroFocus/robodriver","owner":"MicroFocus","description":"A WebDriver API to generate native system input events for the purposes of test automation, either locally or on a remote machine.","archived":false,"fork":false,"pushed_at":"2021-01-05T16:51:45.000Z","size":184,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-28T16:49:01.820Z","etag":null,"topics":["cross-platform","selenium","simulation","system-event","ui-automation","webdriver"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MicroFocus.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}},"created_at":"2017-05-25T13:11:37.000Z","updated_at":"2022-03-20T21:57:08.000Z","dependencies_parsed_at":"2022-08-15T16:30:39.543Z","dependency_job_id":null,"html_url":"https://github.com/MicroFocus/robodriver","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroFocus%2Frobodriver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroFocus%2Frobodriver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroFocus%2Frobodriver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroFocus%2Frobodriver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MicroFocus","download_url":"https://codeload.github.com/MicroFocus/robodriver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239611992,"owners_count":19668274,"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":["cross-platform","selenium","simulation","system-event","ui-automation","webdriver"],"created_at":"2024-12-28T16:49:06.751Z","updated_at":"2025-11-16T20:30:14.535Z","avatar_url":"https://github.com/MicroFocus.png","language":"Java","readme":"# robodriver\n\n\u003e Note: requires Selenium 3.141.59.\n\nA platform independent WebDriver API implementation for native I/O control, either locally or on a remote machine:\n\n* Screenshots\n* Mouse moves\n* Drag and Drop\n* Keyboard inputs\n* Find and click image on screen\n* Remoting: Selenium server/grid support\n* Java, Python, C#, JavaScript, Ruby\n\n```java\nRemoteWebDriver robo = new RoboDriver();\n\n// find the default screen,\nWebElement screen = robo.findElementByXPath(\"//screen[@default=true]\");\n\n// type keys \nscreen.sendKeys(\"hello robodriver\");\n\n// click to the screen at x,y position\nnew Actions(robo)\n\t.moveToElement(screen, 100, 200)\n\t.click()\n\t.perform();\n```\n\n## Python, JavaScript, Ruby...\n\nAny language binding can be used when running robodriver with Selenium server, see also chapter Remote Execution below. \n\nExample in Python:\n\n```python\nfrom selenium import webdriver\nfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilities\nfrom selenium.webdriver.common.keys import Keys\nfrom selenium.webdriver.common.action_chains import ActionChains\n\nserver_endpoint = \"http://127.0.0.1:4444/wd/hub\"\n\n# connect robodriver to the Selenium server\nrobo_capabilities={\n    'browserName': 'io.test.automation.robodriver', \n    'platform':    'ANY' }\nrobo = webdriver.Remote(server_endpoint, robo_capabilities)\n\n# type 'HELLO' to the default screen by sending native keyboard events\nActionChains(robo)         \\\n    .key_down(Keys.SHIFT)  \\\n    .send_keys('hello')    \\\n    .key_up(Keys.SHIFT)    \\\n    .perform()\n```\n\n## Drag \u0026 Drop\n\nFor drag and drop it is needed to provide a source and target element. For those elements a `//rectangle` of a screen\ncan be used, defined by x,y coordinates of its left upper corner, width and height can be zero, for example:\n\n\u003e Note: The origin of **robodriver** `WebElement` objects like screens and rectangles is at the **top left-hand** with X coordinates increasing to the right and Y coordinates increasing downwards. \n\u003e This is different to Selenium DOM elements and W3C Actions, where the origin of a **Browser** `WebElement` is the center of the element.\n\n```java\nWebElement source = screen.findElement(\n\tBy.xpath(String.format(\"//rectangle[@dim='%d,%d,0,0']\", xFrom, yFrom)));\nWebElement target = screen.findElement(\n\tBy.xpath(String.format(\"//rectangle[@dim='%d,%d,0,0']\", xTo, yTo)));\n  \nnew Actions(robo)\n\t.dragAndDrop(source, target)\n\t.perform();\n```\n\n## Capture Screenshot or Rectangle\n\nTo capture full screen or rectanlge areas the screen and rectangle element objects can be used:\n\n```java\n// get screenshot from default monitor\nFile screenshotFile = robo.getScreenshotAs(OutputType.FILE);\n\n// get screenshot from a specific monitor\nWebElement screen = robo.findElementByXPath(\"/screen[0]\");\nFile screenshotFile = screen.getScreenshotAs(OutputType.FILE);\n\n// capture a specific area from the default screen,\n// at pixel position 50,100 (from left upper corner) and width = 300, height = 500\nWebElement screenRectangle = robo.findElementByXPath(\n    \"//screen[@default=true]//rectangle[@dim='50, 100, 300, 500']\");\nFile screenRectangleFile = screenRectangle.getScreenshotAs(OutputType.FILE);\n```\n\n## Find and Click Image on Screen\n\nTo find and click for example to an icon `//rectangle`\nsupports also URIs to find an image on the screen.\n\n#### Find Image by data URI\n\nThis is convenient in remote scenarios.\n\n```java\nWebElement image = remoteRobo.findElementByXPath(\n  String.format(\"//screen[@default=true]//rectangle[@img='%s']\", \n    \"data:image/png;base64,iVBORw0KGgoA...CYII=\"));\nimage.click();\n```\n\n#### Find Image by file URI\n\n```java\nFile imageToFind = new File(\"images/send-mail.png\");\n\nWebElement image = remoteRobo.findElementByXPath(\n  String.format(\"//screen[@default=true]//rectangle[@img='%s']\", \n    imageToFind.toURI());\nimage.click();\n```\n\n## Build\n\nEasiest way to build robodriver.jar is using Maven and build file `pom.xml`, install Maven from \n[Apache Maven Project](https://maven.apache.org/)\n\n1. Clone the project.\n\n1. Open a shell window in the folder, usually: `../robodriver`.\n\n1. Ensure Chrome is installed and extend the environment search path to find latest chromedriver binary, it is needed for test runs .\n\n1. Build and run tests with maven command `mvn install`, to skip the test runs you can use `mvn install -DskipTests`.\n\n1. See robodriver.jar file in output folder `./target`.\n\n## Tools\n\nThe utility `Keyboard` opens a window that logs Selenium key codes and also system dependent virtual key codes \nfor the current keyboard in use. \nTo start this tool use maven to build robodriver and run `mvn exec:java` from the command line.\nThe Selenium class `Keys` do not support all virtual keys of a specific keyboard, for example to type a grave or acute \nthe virtual key code constants can be used. Use `Keyboard` to find the specific VK-IDs or see VK_xxx constants of \n[KeyEvent javadoc](https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html).\n   \nExample: `Keyboard` outputs typing a latin capital letter A with acute\n```\nKeys.SHIFT           VK_SHIFT                       (key=Shift, char='￿', ext-code=0x10)\nKeys.\u003cNO VK\u003e         VK_DEAD_ACUTE                  (key=Dead Grave, char='`', ext-code=0x81)\nKeys.\u003cNO VK\u003e         VK_A                           (key=A, char='A', ext-code=0x41)\n```\n\nIn your script you can use the VK_xxx constant names, they are interpreted by robodriver on replay:\n```java\nnew Actions(robo)\n\t.keyDown(Keys.SHIFT)\n\t.perform();\nscreen.sendKeys(\"VK_DEAD_ACUTE\", \"A\"); \nnew Actions(robo)\n\t.keyUp(Keys.SHIFT)\n\t.perform();\n```\n\nThe implementation can be found in class `io.test.automation.robodriver.tools.Keyboard`. \n\n\n## Remote Execution\n\nSelenium server can be extended to use robodriver to drive applications on a remote machine.\nWith that robodriver becomes client binding language agnostic. \nOn server startup the `robodriver.jar` will be loaded by the \ndynamic webdriver loading feature of the Selenium server. \nSee also the webdriver provider file `META-INF/services/org.openqa.selenium.remote.server.DriverProvider`  \n\n1. Download Selenium Standalone Server from the [Selenium Project](http://www.seleniumhq.org/download/)\n\n1. Build `robodriver.jar` using Maven build file `pom.xml`, see above.\n\n1. Start server with `robodriver.jar` in the classpath, for example: \n```\njava -cp ./robodriver.jar;./selenium-server-standalone-v.v.jar org.openqa.grid.selenium.GridLauncherV3\n```\n\n\u003e Note: `robodriver.jar` must be before the Selenium server JAR in the classpath. \n\u003e This is required because of a needed patch to support W3C Actions protocol for the robodrivers `DriverProvider` implementation\n\u003e and will be obsolete as soon Selenium server supports to configure the needed dialect. For the patched code see classes in package `org.openqa.selenium...`.\n\nPortable example in Java:\n\n```java\nURL serverEndpoint = new URL(\"http://localhost:4444/wd/hub\");\n\nDesiredCapabilities roboCapabilities = new DesiredCapabilities();\nroboCapabilities.setCapability(\"browserName\", \"io.test.automation.robodriver\");\nroboCapabilities.setCapability(\"platform\", \"ANY\");\n\nRemoteWebDriver robodriver = new RemoteWebDriver(serverEndpoint, roboCapabilities);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrofocus%2Frobodriver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrofocus%2Frobodriver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrofocus%2Frobodriver/lists"}