Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RemoteWebDriver

Diego Molina edited this pageDec 5, 2025 ·2 revisions

Please note: this content might be out of date. The official documentation about remote WebDriver can be foundhere.

Remote WebDriver

This is information about using the client implementation of the RemoteWebDriver. This is the code that is used within your tests. For information on how to set up the server-side, please take a look at the RemoteWebDriverServer page.

Installing

Download the "selenium-server.zip" and unpack. Put the JARs on the CLASSPATH. This will give you the remote webdriver client, which is generally what you need. Please consult the RemoteWebDriverServer for information on how to set up the server-side of the remote webdriver.

Pros

  • Separates where the tests are running from where the browser is.
  • Allows tests to be run with browsers not available on the current OS (because the browser can be elsewhere)

Cons

  • Requires an external servlet container to be running
  • You may find problems with line endings when getting text from the remote server
  • Introduces extra latency to tests, particularly when exceptions are thrown.

Using

This is probably best demonstrated with some code:

// We could use any driver for our tests...DesiredCapabilities capabilities = new DesiredCapabilities();// ... but only if it supports javascriptcapabilities.setJavascriptEnabled(true);// Get a handle to the driver. This will throw an exception// if a matching driver cannot be locatedWebDriver driver = new RemoteWebDriver(capabilities);// Query the driver to find out more informationCapabilities actualCapabilities = ((RemoteWebDriver) driver).getCapabilities();// And now use itdriver.get("http://www.google.com");

This section is out of date. Please refer to screenshotshereOne nice feature of the remote webdriver is that exceptions often have an attached screen shot, encoded as a Base64 PNG. In order to get this screenshot, you need to write code similar to:

public String extractScreenShot(WebDriverException e) {  Throwable cause = e.getCause();  if (cause instanceof ScreenshotException) {    return ((ScreenshotException) cause).getBase64EncodedScreenshot();  }  return null;}

RemoteWebDriver Modes

The remote webdriver comes in two flavours:

  • Client mode: where the language bindings connect to the remote instance. This is the way that the FirefoxDriver, OperaDriver and the RemoteWebDriver client normally work.
  • Server mode: where the language bindings are responsible for setting up the server, which the driver running in the browser can connect to. The ChromeDriver works in this way.

We realise that these terms are confusing, so please feel free to suggest something better!

Notice for Users

This wiki is not where you want to be!Visit the Wiki Home for more useful links

For Developers and Contributors

Getting Involved
Triaging Issues
Releasing Selenium

Binding Specific Information

Ruby Development
Python Bindings
Ruby Bindings
WebDriverJs

Being Processed

This content is being evaluated for where it belongs

Architectural Overview
Automation Atoms
HtmlUnitDriver
Lift Style API
LoadableComponent
Logging
PageFactory
RemoteWebDriver
Xpath In WebDriver

Archived

Moved toOfficial Documentation

Bot Style Tests
Buck
Continuous Integration
Crazy Fun Build
Design Patterns
Desired Capabilities
Developer Tips
Domain Driven Design
Firefox Driver
Firefox Driver Internals
Focus Stealing On Linux
Frequently Asked Questions
Google Summer Of Code
Grid Platforms
History
Internet Explorer Driver
InternetExplorerDriver Internals
Next Steps
PageObjects
RemoteWebDriverServer
Roadmap
Scaling WebDriver
SeIDE Release Notes
Selenium Emulation
Selenium Grid 4
Selenium Help
Shipping Selenium 3
The Team
TLC Meetings
Untrusted SSL Certificates
WebDriver For Mobile Browsers
Writing New Drivers

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp