jBrowserDriver

所属分类:前端开发
开发工具:Java
文件大小:409KB
下载次数:0
上传日期:2021-03-31 20:54:35
上 传 者sh-1993
说明:  与Selenium WebDriver规范兼容的可编程嵌入式web浏览器驱动程序——无头、基于WebKit...
(A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java)

文件列表:
.classpath (714, 2019-10-01)
.project (999, 2019-10-01)
.settings (0, 2019-10-01)
.settings\org.eclipse.core.resources.prefs (74, 2019-10-01)
.settings\org.eclipse.jdt.core.prefs (422, 2019-10-01)
.settings\org.eclipse.m2e.core.prefs (86, 2019-10-01)
.settings\org.eclipse.wst.common.component (237, 2019-10-01)
.settings\org.eclipse.wst.common.project.facet.core.xml (167, 2019-10-01)
.settings\org.eclipse.wst.validation.prefs (48, 2019-10-01)
CLA-individual.txt (5849, 2019-10-01)
CLA-rev2-digital.txt (1759, 2019-10-01)
LICENSE (15207, 2019-10-01)
NOTICE (121, 2019-10-01)
PULL_REQUEST_TEMPLATE (283, 2019-10-01)
dependency-docs (66, 2019-10-01)
pom.xml (17576, 2019-10-01)
src (0, 2019-10-01)
src\META-INF (0, 2019-10-01)
src\META-INF\services (0, 2019-10-01)
src\META-INF\services\org.openqa.selenium.remote.server.DriverProvider (53, 2019-10-01)
src\com (0, 2019-10-01)
src\com\machinepublishers (0, 2019-10-01)
src\com\machinepublishers\glass (0, 2019-10-01)
src\com\machinepublishers\glass\ui (0, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle (0, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\Framebuffer.java (10220, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\HeadlessPlatform.java (2155, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\HeadlessPlatformFactory.java (1868, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\HeadlessScreen.java (4026, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\InputDevice.java (2447, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\InputDeviceRegistry.java (1993, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\IntSet.java (4966, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\KeyInput.java (9920, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\KeyState.java (4223, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\MonocleApplication.java (13860, 2019-10-01)
src\com\machinepublishers\glass\ui\monocle\MonocleClipboardDelegate.java (2215, 2019-10-01)
... ...

# jBrowserDriver A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java Licensed under the Apache License v2.0 ([details](https://raw.githubusercontent.com/MachinePublishers/jBrowserDriver/master/LICENSE)). - - - ## Download Get a ZIP archive of a [recent release](https://github.com/MachinePublishers/jBrowserDriver/releases/latest). Or install via Maven: ```xml com.machinepublishers jbrowserdriver 1.1.1 ``` For other install options, see the [Central Repository](https://search.maven.org/artifact/com.machinepublishers/jbrowserdriver/1.1.1/jar). ## Prerequisites Java 8 with JavaFX: * Ubuntu Xenial 16.04 LTS, Debian 8 Jessie ([Backports](https://backports.debian.org/Instructions/#index2h2)), Debian 9 Stretch:
    `sudo apt-get install openjdk-8-jre openjfx` * Ubuntu Trusty 14.04 LTS:
    `sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update && sudo apt-get install oracle-java8-installer libgtk2.0 libxtst6 libxslt1.1 fonts-freefont-ttf libasound2 && sudo update-alternatives --config java` * Mac, Windows, Linux:
    [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)* ## Usage For specific details, refer to the [API documentation](http://machinepublishers.github.io/jBrowserDriver/). Use this library like any other Selenium WebDriver or RemoteWebDriver. It also works with Selenium Server and Selenium Grid (see example below). You 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. Settings 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. Each instance of JBrowserDriver is backed by a separate Java process. #### Example: ```java import org.openqa.selenium.WebDriver; import com.machinepublishers.jbrowserdriver.Timezone; import com.machinepublishers.jbrowserdriver.JBrowserDriver; import com.machinepublishers.jbrowserdriver.Settings; public class Example { public static void main(String[] args) { // You can optionally pass a Settings object here, // constructed using Settings.Builder JBrowserDriver driver = new JBrowserDriver(Settings.builder(). timezone(Timezone.AMERICA_NEWYORK).build()); // This will block for the page load and any // associated AJAX requests driver.get("http://example.com"); // You can get status code unlike other Selenium drivers. // It blocks for AJAX requests and page loads after clicks // and keyboard events. System.out.println(driver.getStatusCode()); // Returns the page source in its current state, including // any DOM updates that occurred after page load System.out.println(driver.getPageSource()); // Close the browser. Allows this thread to terminate. driver.quit(); } } ``` #### Running from a remote Selenium server: You can also run JBrowserDriver from a remotely running Selenium server. First start the remote selenium server(s): * If you are running using Selenium standalone mode: 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` * If you are running using Selenium Grid mode: Start the hub: `java -jar selenium-server-standalone-2.53.0.jar -role hub` 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`   *On Windows, replace the colon in the classpath with a semi-colon.* Whether you are using standalone mode or grid mode, you can use this code to call jBrowserDriver remotely: ```java import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.Platform; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import com.machinepublishers.jbrowserdriver.Settings; import com.machinepublishers.jbrowserdriver.Timezone; public class Example { public static void main(String[] args) throws MalformedURLException { DesiredCapabilities capabilities = new DesiredCapabilities("jbrowserdriver", "1", Platform.ANY); // Optionally customize the settings capabilities.merge( Settings.builder(). timezone(Timezone.AMERICA_NEWYORK). buildCapabilities()); RemoteWebDriver driver = new RemoteWebDriver( new URL("http://localhost:4444/wd/hub"), capabilities); driver.get("http://example.com"); System.out.println(driver.getPageSource()); driver.quit(); } } ``` ## Building Install 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. ## Contributing Pull 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. Feel free to discuss bugs and new features by opening a [new issue](https://github.com/MachinePublishers/jBrowserDriver/issues/new). ## Support Purchase support and development services by contacting ops@machinepublishers.com - - - Copyright (C) 2014-2018 jBrowserDriver committers

近期下载者

相关文件


收藏者