{"id":25776646,"url":"https://github.com/hollingsworthd/jBrowserDriver","last_synced_at":"2025-02-27T06:06:48.972Z","repository":{"id":25878211,"uuid":"29318475","full_name":"hollingsworthd/jBrowserDriver","owner":"hollingsworthd","description":"A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java","archived":false,"fork":false,"pushed_at":"2024-07-29T19:06:55.000Z","size":9665,"stargazers_count":810,"open_issues_count":115,"forks_count":143,"subscribers_count":61,"default_branch":"master","last_synced_at":"2024-09-09T22:54:33.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hollingsworthd.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":"2015-01-15T21:12:32.000Z","updated_at":"2024-08-16T01:22:03.000Z","dependencies_parsed_at":"2024-09-09T22:54:38.835Z","dependency_job_id":"19353134-31bc-4f63-a26a-624dd9f001bd","html_url":"https://github.com/hollingsworthd/jBrowserDriver","commit_stats":null,"previous_names":["machinepublishers/jbrowserdriver"],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollingsworthd%2FjBrowserDriver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollingsworthd%2FjBrowserDriver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollingsworthd%2FjBrowserDriver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollingsworthd%2FjBrowserDriver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hollingsworthd","download_url":"https://codeload.github.com/hollingsworthd/jBrowserDriver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240987435,"owners_count":19889334,"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":[],"created_at":"2025-02-27T06:01:28.238Z","updated_at":"2025-02-27T06:06:48.964Z","avatar_url":"https://github.com/hollingsworthd.png","language":"Java","funding_links":[],"categories":["测试"],"sub_categories":[],"readme":"# jBrowserDriver\nA programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java\n\nLicensed under the Apache License v2.0 ([details](https://raw.githubusercontent.com/MachinePublishers/jBrowserDriver/master/LICENSE)).\n\n- - -\n\n## Download\nGet a ZIP archive of a [recent release](https://github.com/MachinePublishers/jBrowserDriver/releases/latest).\n\nOr install via Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.machinepublishers\u003c/groupId\u003e\n  \u003cartifactId\u003ejbrowserdriver\u003c/artifactId\u003e\n  \u003cversion\u003e1.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\nFor other install options, see the [Central Repository](https://search.maven.org/artifact/com.machinepublishers/jbrowserdriver/1.1.1/jar).\n\n## Prerequisites\nJava 8 with JavaFX:\n * Ubuntu Xenial 16.04 LTS, Debian 8 Jessie ([Backports](https://backports.debian.org/Instructions/#index2h2)), Debian 9 Stretch:\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`sudo apt-get install openjdk-8-jre openjfx`\n * Ubuntu Trusty 14.04 LTS:\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`sudo add-apt-repository ppa:webupd8team/java \u0026\u0026 sudo apt-get update \u0026\u0026 sudo apt-get install oracle-java8-installer libgtk2.0 libxtst6 libxslt1.1 fonts-freefont-ttf libasound2 \u0026\u0026 sudo update-alternatives --config java`\n * Mac, Windows, Linux:\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;[install Oracle Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) *(note: choose either the JRE or JDK but not the \"Server JRE\" since it doesn't include JavaFX)*\n\n## Usage\nFor specific details, refer to the [API documentation](http://machinepublishers.github.io/jBrowserDriver/).\n\nUse this library like any other Selenium WebDriver or RemoteWebDriver. It also works with Selenium Server and Selenium Grid (see example below).\n\nYou can optionally create a [Settings](http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/Settings.html) object, [configure it](http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/Settings.Builder.html), and pass it to the [JBrowserDriver constructor](http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/JBrowserDriver.html#JBrowserDriver-com.machinepublishers.jbrowserdriver.Settings-) to specify a proxy, request headers, time zone, user agent, or navigator details. By default, the browser mimics the fingerprint of Tor Browser.\n\nSettings can alternately be configured using Java system properties or Selenium Capabilities. See [Settings builder](http://machinepublishers.github.io/jBrowserDriver/com/machinepublishers/jbrowserdriver/Settings.Builder.html) documentation for details.\n\nEach instance of JBrowserDriver is backed by a separate Java process.\n\n#### Example:\n```java\nimport org.openqa.selenium.WebDriver;\nimport com.machinepublishers.jbrowserdriver.Timezone;\nimport com.machinepublishers.jbrowserdriver.JBrowserDriver;\nimport com.machinepublishers.jbrowserdriver.Settings;\n    \npublic class Example {\n  public static void main(String[] args) {\n\n    // You can optionally pass a Settings object here,\n    // constructed using Settings.Builder\n    JBrowserDriver driver = new JBrowserDriver(Settings.builder().\n      timezone(Timezone.AMERICA_NEWYORK).build());\n\n    // This will block for the page load and any\n    // associated AJAX requests\n    driver.get(\"http://example.com\");\n\n    // You can get status code unlike other Selenium drivers.\n    // It blocks for AJAX requests and page loads after clicks \n    // and keyboard events.\n    System.out.println(driver.getStatusCode());\n\n    // Returns the page source in its current state, including\n    // any DOM updates that occurred after page load\n    System.out.println(driver.getPageSource());\n    \n    // Close the browser. Allows this thread to terminate.\n    driver.quit();\n  }\n}\n```\n\n#### Running from a remote Selenium server:\n\nYou can also run JBrowserDriver from a remotely running Selenium server.\n\nFirst start the remote selenium server(s):\n\n * If you are running using Selenium standalone mode:\n\n    Start the standalone server: `java -classpath \"selenium-server-standalone-2.53.0.jar:jBrowserDriver-v0.17.0/dist/*\" org.openqa.grid.selenium.GridLauncher -browser browserName=jbrowserdriver,version=1,platform=ANY`\n\n * If you are running using Selenium Grid mode:\n\n    Start the hub: `java -jar selenium-server-standalone-2.53.0.jar -role hub`\n\n    Start the node: `java -classpath \"selenium-server-standalone-2.53.0.jar:jBrowserDriver-v0.17.0/dist/*\" org.openqa.grid.selenium.GridLauncher -role node http://localhost:4444/grid/register -browser browserName=jbrowserdriver,version=1,platform=ANY`\n\n\u0026nbsp;\u0026nbsp;*On Windows, replace the colon in the classpath with a semi-colon.*\n\nWhether you are using standalone mode or grid mode, you can use this code to call jBrowserDriver remotely:\n\n```java\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport org.openqa.selenium.Platform;\nimport org.openqa.selenium.remote.DesiredCapabilities;\nimport org.openqa.selenium.remote.RemoteWebDriver;\nimport com.machinepublishers.jbrowserdriver.Settings;\nimport com.machinepublishers.jbrowserdriver.Timezone;\n\npublic class Example {\n  public static void main(String[] args) throws MalformedURLException {\n  \n    DesiredCapabilities capabilities = \n        new DesiredCapabilities(\"jbrowserdriver\", \"1\", Platform.ANY);\n    \n    // Optionally customize the settings\n    capabilities.merge(\n        Settings.builder().\n        timezone(Timezone.AMERICA_NEWYORK).\n        buildCapabilities());\n    \n    RemoteWebDriver driver = new RemoteWebDriver(\n        new URL(\"http://localhost:4444/wd/hub\"), capabilities);\n    \n    driver.get(\"http://example.com\");\n    \n    System.out.println(driver.getPageSource());\n    \n    driver.quit();\n  }\n}\n```\n\n## Building\nInstall and configure [Maven v3.x](https://maven.apache.org/download.cgi) (which is also available in most Linux package repos) and then from the project root run `mvn clean compile install`. To use in [Eclipse](http://www.eclipse.org/downloads/), either import the existing Java project from the root directory or import the Maven pom.xml file. However, if you merely want to use this as a dependency in a separate project, see the [Download](https://github.com/MachinePublishers/jBrowserDriver#download) section.\n\n## Contributing\nPull requests are welcome, and we ask people contributing code to agree to the [CLA](https://github.com/MachinePublishers/jBrowserDriver/blob/master/CLA-rev2-digital.txt) which is similar to the agreement used by the Selenium Project. Signing the CLA is simply a matter of editing the file to add your digital \"signature\" and adding it to your pull request.\n\nFeel free to discuss bugs and new features by opening a [new issue](https://github.com/MachinePublishers/jBrowserDriver/issues/new).\n\n## Support\nPurchase support and development services by contacting ops@machinepublishers.com\n\n- - -\n\nCopyright (C) 2014-2018 jBrowserDriver committers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhollingsworthd%2FjBrowserDriver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhollingsworthd%2FjBrowserDriver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhollingsworthd%2FjBrowserDriver/lists"}