---
title: 云中的Selenium自动化
description: TestingBot提供一个基于云的Selenium网格。将你的Selenium WebDriver测试与浏览器和设备的在线网格相连。
source_url:
  html: https://zh.testingbot.com/features/automation/selenium
  md: https://zh.testingbot.com/features/automation/selenium.md
---

Selenium WebDriver 
# Selenium Cloud Automation

在 6100+ 个真实浏览器和 iOS/Android 真机上运行 Selenium WebDriver 测试。强大的并行处理能力、视频和日志生成功能，以及经过实战检验的基础架构，正常运行时间 SLA 高达 99.9%。

想比较不同的框架？请查看[Playwright 与 Selenium 的](https://zh.testingbot.com/playwright-vs-selenium)对比分析。

[免费开始](https://zh.testingbot.com/users/sign_up) [申请演示](https://testingbot.com/demo)

- **浏览器和设备:** 6100+
- **Selenium 版本:** 全部
- **正常运行时间服务级别协议:** 99.9%

_Selenium tests running on Chrome, Firefox, Safari, Edge, Opera, Samsung, iOS and Android via TestingBot's cloud hub_

被世界上一些最具创新性的公司所信任

 5线设置 
## 将您现有的测试指向我们的中心

只需更改一个 URL 即可。您可以重用现有的 Selenium WebDriver 代码，将其运行在我们的云端，并通过功能选择任何浏览器、操作系统或设备。

 hub.testingbot.com Copy

 JavaScript Python Java Ruby C# PHP 

```javascript
// Run a Selenium test on the TestingBot grid
const wd = require('selenium-webdriver');

const driver = await new wd.Builder()
  .usingServer('https://hub.testingbot.com/wd/hub')
  .withCapabilities({
    'tb:options': { name: 'Checkout flow' },
    browserName: 'chrome',
    browserVersion: 'latest',
    platformName: 'Windows 11'
  })
  .build();

await driver.get('https://example.com');
await driver.quit();
```

```python
# Run a Selenium test on the TestingBot grid
from selenium import webdriver

options = webdriver.ChromeOptions()
options.set_capability('tb:options', {'name': 'Checkout flow'})
options.set_capability('browserVersion', 'latest')
options.set_capability('platformName', 'Windows 11')

driver = webdriver.Remote(
    command_executor='https://hub.testingbot.com/wd/hub',
    options=options
)

driver.get('https://example.com')
driver.quit()
```

```java
// Run a Selenium test on the TestingBot grid
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browserName", "chrome");
caps.setCapability("browserVersion", "latest");
caps.setCapability("platformName", "Windows 11");

WebDriver driver = new RemoteWebDriver(
    new URL("https://hub.testingbot.com/wd/hub"),
    caps
);

driver.get("https://example.com");
driver.quit();
```

```ruby
# Run a Selenium test on the TestingBot grid
require 'selenium-webdriver'

caps = Selenium::WebDriver::Remote::Capabilities.chrome(
  browserVersion: 'latest',
  platformName: 'Windows 11',
  'tb:options' => { name: 'Checkout flow' }
)

driver = Selenium::WebDriver.for(:remote,
  url: 'https://hub.testingbot.com/wd/hub',
  capabilities: caps
)

driver.get 'https://example.com'
driver.quit
```

```csharp
// Run a Selenium test on the TestingBot grid
var options = new ChromeOptions();
options.AddAdditionalOption("browserVersion", "latest");
options.AddAdditionalOption("platformName", "Windows 11");

IWebDriver driver = new RemoteWebDriver(
    new Uri("https://hub.testingbot.com/wd/hub"),
    options
);

driver.Navigate().GoToUrl("https://example.com");
driver.Quit();
```

```php
// Run a Selenium test on the TestingBot grid
$capabilities = DesiredCapabilities::chrome();
$capabilities->setCapability('browserVersion', 'latest');
$capabilities->setCapability('platformName', 'Windows 11');

$driver = RemoteWebDriver::create(
    'https://hub.testingbot.com/wd/hub',
    $capabilities
);

$driver->get('https://example.com');
$driver->quit();
```

Connected · [Dokumentation anzeigen](https://testingbot.com/support/web-automate/selenium/nodejs) [Dokumentation anzeigen](https://testingbot.com/support/web-automate/selenium/python) [Dokumentation anzeigen](https://testingbot.com/support/web-automate/selenium/java) [Dokumentation anzeigen](https://testingbot.com/support/web-automate/selenium/ruby) [Dokumentation anzeigen](https://testingbot.com/support/web-automate/selenium/csharp) [Dokumentation anzeigen](https://testingbot.com/support/web-automate/selenium/php) 

 ![测试结果](https://zh.testingbot.com/assets/features/test-results-315382c39a67ad52167d2a4fd78570c99aea3e0ec386c17e82265851e93cb7b3.png)

 Test Results 
## 测试结果

每个Selenium测试结果都有屏幕截图、日志和测试视频。

将Selenium测试标记为通过或失败，通过我们的REST-API检索测试工件，并通过各种[集成](https://zh.testingbot.com/integrations)连接你的测试结果。

通过指定各种选项来定制Selenium会话，包括。

- 自定义Selenium版本（Selenium 4 + W3C支持可用，即将推出的WebDriver BiDi）。
- 自定义屏幕分辨率
- 自定义时区
- 改变地理位置
- 浏览器启动标志和[更多](https://testingbot.com/support/web-automate/selenium/test-options)

 语言和框架 
## Selenium集成

TestingBot与各种测试框架和服务集成。轻松地转换你现有的Selenium测试，并与你最喜欢的CI/CD连接。

- ### [Java](https://testingbot.com/support/web-automate/selenium/java)

  - [JUnit](https://testingbot.com/support/web-automate/selenium/java/junit)
  - [Parallel JUnit](https://testingbot.com/support/web-automate/selenium/java/parallel-junit)
  - [TestNG](https://testingbot.com/support/web-automate/selenium/java/testng)
  - [Selenide](https://testingbot.com/support/web-automate/selenium/java/selenide)

- ### [Python](https://testingbot.com/support/web-automate/selenium/python)

  - [PyTest](https://testingbot.com/support/web-automate/selenium/python/pytest)
  - [PyUnit](https://testingbot.com/support/web-automate/selenium/python/pyunit)
  - [Behave](https://testingbot.com/support/web-automate/selenium/python/behave)
  - [Helium](https://testingbot.com/support/web-automate/selenium/python/helium)

- ### [JavaScript](https://testingbot.com/support/web-automate/selenium/nodejs)

  - [WebDriverIO](https://testingbot.com/support/web-automate/selenium/nodejs/webdriverio)
  - [Nightwatch](https://testingbot.com/support/web-automate/selenium/nodejs/nightwatch)
  - [Protractor](https://testingbot.com/support/web-automate/selenium/nodejs/protractor)
  - [TestCafe](https://testingbot.com/support/web-automate/selenium/nodejs/testcafe)

- ### [Ruby](https://testingbot.com/support/web-automate/selenium/ruby)

  - [RSpec](https://testingbot.com/support/web-automate/selenium/ruby/rspec)
  - [Cucumber](https://testingbot.com/support/web-automate/selenium/ruby/cucumber)
  - [Minitest](https://testingbot.com/support/web-automate/selenium/ruby/minitest)
  - [Test::Unit](https://testingbot.com/support/web-automate/selenium/ruby/testunit)

- ### [C#](https://testingbot.com/support/web-automate/selenium/csharp)

  - [NUnit](https://testingbot.com/support/web-automate/selenium/csharp/nunit)
  - [MSTest](https://testingbot.com/support/web-automate/selenium/csharp/mstest)
  - [xUnit](https://testingbot.com/support/web-automate/selenium/csharp/xunit)
  - [SpecFlow](https://testingbot.com/support/web-automate/selenium/csharp/specflow)

- ### [PHP](https://testingbot.com/support/web-automate/selenium/php)

  - [PHPUnit](https://testingbot.com/support/web-automate/selenium/php/phpunit)
  - [Codeception](https://testingbot.com/support/web-automate/selenium/php/codeception)
  - [Behat](https://testingbot.com/support/web-automate/selenium/php/behat-mink)
  - [SimpleTest](https://testingbot.com/support/web-automate/selenium/php/simpletest)

想在不写代码的情况下运行测试？用[Selenium IDE](https://testingbot.com/support/web-automate/codeless-automation/add-test)记录测试，并在我们的无代码自动化中上传这些测试，以便按计划执行。

 大规模并行 
## 平行测试

通过同时运行测试，大大缩短了你的Selenium测试总时长。TestingBot在Windows、Linux和macOS上提供一次性使用的虚拟机，为速度和稳定性进行了优化。

- 最多可同时运行 100 个 Selenium 会话
- 无需排队，无需热身。课程秒速开始。
- 自动重试和智能测试分片

[免费开始](https://zh.testingbot.com/users/sign_up)

 ![平行测试](https://zh.testingbot.com/assets/features/selenium/parallel-0229d698e59a8a6b92fe50344a08634624f018331ecf8a849ef83cfb35e635a5.png)

Live exit nodes
10+ countries

美国

英国

德国

法国

西班牙

比利时

澳大利亚

中国

日本

 地理位置测试 
## 地理定位测试

在全球各个地区进行 **地理位置测试** 。在澳大利亚、比利时、英国、美国、德国、法国、西班牙、中国等10个国家测试地理定位、地理封锁和地理本地化。

 安全的基础设施 
## 准确的测试

你的测试在一个安全的数据中心，在真实的操作系统上运行。每个测试都在一个专用的、一次性使用的虚拟机中运行，在测试结束后被销毁。

我们的基础设施经过了优化，以提高性能和降低测试的松散性。

- 一次性虚拟机，每次会话结束后都会被清除
- 符合 GDPR 标准，可提供欧盟数据驻留服务
- SAML SSO、审计日志和 SCIM 配置

[访问 TestingBot 信任中心](https://trust.testingbot.com/)

1. 1

Test connects to `hub.testingbot.com`

A pristine VM is provisioned in seconds, just for your session.

2. 2

Your Selenium commands run on real hardware

Real Windows, macOS or Linux — never simulated, never shared.

3. 3

VM destroyed the moment your test ends

Cookies, files, browser state — all wiped. Nothing is ever reused.

 持续集成 
## 与CI/CD服务的整合

TestingBot与最流行的CI/CD服务集成，包括Jenkins、Bamboo、TeamCity、Circle CI、GitLab CI等。

 ![Jenkins](https://zh.testingbot.com/assets/integrations/jenkins-e586a1c4af833e4c8d38d7b392a4e84bd193f30cae9cf8c9f198a58ec943a1ff.webp)

### [Jenkins](https://testingbot.com/support/integrations/ci-cd/jenkins)

 ![Bamboo](https://zh.testingbot.com/assets/integrations/bamboo-c8fe09a3cb0b74d6055e3aa6607d77720bfe29ff487b8e3cf825138adf634346.svg)

### [Bamboo](https://testingbot.com/support/integrations/ci-cd/bamboo)

 ![TeamCity](https://zh.testingbot.com/assets/integrations/teamcity-7e75cdb835903a4983ad276c41d95e569ceac5be486e96ec1f955029ce5bb319.svg)

### [TeamCity](https://testingbot.com/support/integrations/ci-cd/teamcity)

 ![CircleCI](https://zh.testingbot.com/assets/integrations/circleci-ede029654ff39b60342e4a5bba8fc9a3a49305cc38bda215b7cf8d07e85e0543.webp)

### [CircleCI](https://testingbot.com/support/integrations/ci-cd/circleci)

 ![GitLab CI](https://zh.testingbot.com/assets/integrations/gitlab-e4c0b6db07d07bc0a400f5606e258f4dc8a51b778e97bbfa51d1d531f3cb049a.webp)

### [GitLab CI](https://testingbot.com/support/integrations/ci-cd/gitlab)

 ![GitHub](https://zh.testingbot.com/assets/integrations/github-actions-8436242ad9e15381f84f1a98a10dddce15611087f121d6305782e211942b7842.webp)

### [GitHub](https://testingbot.com/support/integrations/ci-cd/github-actions)

 移动版 Selenium 
## 移动测试

在实体的iOS和Android移动设备上测试，或在iOS模拟器和Android模拟器上测试。在各种移动设备和版本上测试你的网站功能和用户界面，并支持地理位置。

[查看设备](https://testingbot.com/support/app-automate/devices)

 ![Test online on iPhone 17 Pro](https://zh.testingbot.com/assets/devices/160h/44-6b4402c6996d9b1620879bb1123c40a6b36abb064e65dca0a1b3f05286779e9c.webp)

iPhone 17 Pro

 ![Test online on iPhone 17 Pro Max](https://zh.testingbot.com/assets/devices/160h/43-59d7e30684332ed4bf25567cbc09ca942eac46d925ccde8352d3e85812480f7d.webp)

iPhone 17 Pro Max

 ![Test online on iPhone 16 Pro](https://zh.testingbot.com/assets/devices/160h/42-de3704079345026847b739a5b1cf5332595904e54ede66abd988a76fb1e6593c.webp)

iPhone 16 Pro

 ![Test online on iPad (9th generation)](https://zh.testingbot.com/assets/devices/160h/41-70f7d18afde7620063a49a76cbfd088f8b59c742f3a5f4dd4a513dd6ec5c676c.webp)

iPad (9th generation)

 ![Test online on Galaxy S26](https://zh.testingbot.com/assets/devices/160h/40-e917ed08e15b5941fed75855ac457dd1df46b471a2020f081c4d70cefb68f4e8.webp)

Galaxy S26

 ![Test online on Huawei P40](https://zh.testingbot.com/assets/devices/160h/39-32a788c7e66a3da1c88eaaefefd37381f729e510f096b43906968b6907c44c57.webp)

Huawei P40

 Secure Tunnel 
## 安全地测试内部和测试环境应用程序

使用我们的[安全隧道](https://testingbot.com/support/tunnel)，针对受防火墙保护的测试站点、内部仪表板或仍在本地主机上的应用程序运行 Selenium 测试。

端到端加密，无需入站防火墙规则，并内置支持流行的 CI 提供商。

 ![TestingBot secure tunnel for Selenium](https://zh.testingbot.com/assets/features/tunnel-diagram-poster-8c25e19e6fe4f7276a46a96b31a0ad0e07bb4f5bf98dc192d2b70897cfbb1a26.png)

[阅读更多](https://zh.testingbot.com/support/tunnel)

 购买还是建造 
## TestingBot 与自托管 Selenium Grid 的比较

自建 Selenium Grid 听起来很便宜，但考虑到维护、稳定性以及设备缺失等问题，就显得不那么划算了。下面我们来看看托管式 Selenium 云平台相比之下有哪些优势。

| 能力 | 测试机器人 | 自托管 Selenium Grid |
| --- | --- | --- |
| 浏览器覆盖范围 | 6100+ 浏览器，所有主要版本，每周更新 | 仅限于您自行配置和修补的内容。 |
| 是时候进行首次测试了 | 几分钟之内，修改代码中的一个 URL。 | 电网设置和调校需要数天到数周时间。 |
| 真正的 iOS 和 Android | 按需提供真实物理设备 | 需要单独的设备实验室 |
| 并行扩展 | 最多可按需支持 100 个并发会话 | 受硬件预算限制 |
| 视频和日志 | 包含视频、网络、浏览器和 Selenium 日志 | 自行实现录制和日志聚合 |
| 可靠性 | 99.9% 正常运行时间 SLA，全天候监控 | 你是值班工程师。 |
| 支持 | 全天候人工支持和专属客户服务经理 | Stack Overflow 和您自己的日志 |

常问问题
## TestingBot 上的 Selenium — 常见问题解答

什么是基于云的 Selenium 网格？

基于云的 Selenium Grid 是一个托管的浏览器节点池，您可以通过`https://hub.testingbot.com/wd/hub`端点连接到该节点池。您现有的 Selenium WebDriver 代码保持不变，只有远程 URL 和一些功能会发生变化。TestingBot 会为您处理操作系统镜像、浏览器安装、扩展和录制等工作。

TestingBot 支持哪些 Selenium 版本？

TestingBot 支持所有仍在使用的 Selenium 版本，从 Selenium 2.x 和 3.x 到 Selenium 4 和 Selenium BiDi。您可以使用 ``se:options`` 或 ``tb:options`` 功能为每个测试指定特定的服务器版本。

我可以并行运行 Selenium 测试吗？

是的。TestingBot 的计划包括最多 100 个并行 Selenium 会话。每个会话都在其独立的单次使用虚拟机中运行，因此测试之间不会相互干扰，并行化也不会导致不稳定。

TestingBot 是否支持 Selenium 4 和 BiDi？

完全支持。我们的中心平台采用 Selenium 4 W3C WebDriver，并支持新的[Selenium BiDi 协议](https://testingbot.com/support/web-automate/selenium/selenium-bidi)，以实现实时日志、网络拦截和身份验证处理等高级功能。

如何将现有的 Selenium 测试迁移到 TestingBot？

将远程 URL 更改为`https://hub.testingbot.com/wd/hub` ，添加您的 TestingBot 凭据，并通过 capabilities 选择浏览器/操作系统。请参阅我们的[迁移指南](https://testingbot.com/support/web-automate/selenium/migrate-existing-tests)，获取各种语言的分步示例。

我可以测试内部站点或测试站点吗？

是的，安装我们的[安全隧道](https://testingbot.com/support/tunnel)后，您的 Selenium 测试就可以访问暂存环境、本地服务器或防火墙后的任何其他内容，无需任何入站规则。

TestingBot 会记录我的 Selenium 测试的视频和日志吗？

每次 Selenium 会话都会录制成全高清视频，同时还会录制 Selenium 命令的详细步骤、浏览器控制台日志、网络 HAR 文件和屏幕截图。这些文件可以从控制面板访问，也可以通过 REST API 集成到持续集成 (CI) 系统中。

Selenium Grid 是否符合 SOC 2 / GDPR 标准？

TestingBot 符合 GDPR 法规，拥有欧盟数据驻留权，并通过了 ISO 27001 标准认证和 STAR 1 级认证。我们为企业版套餐提供 SAML 单点登录 (SSO)、敏感信息安全管理 (SCIM) 和审计日志功能。

## 更多喜爱 TestingBot 的理由

### 24/7 支持

有疑问？欢迎通过 24/7 应用内客服[聊天](https://zh.testingbot.com#)或[发送电子邮件联系我们](https://zh.testingbot.com/contact/new)。我们随时为您服务！

TestingBot 支持

嘿👋我们能帮上什么忙吗？

I need support

### 超过 14,000 个团队信赖

6M+

测试

120k+

用户

400+

企业

106

国家

[申请演示](https://testingbot.com/demo)

### 开发人员文档

将 TestingBot 集成到您的工作流程所需的一切。浏览适用于 Web 和移动测试的指南、API 参考和 SDK。

- [Selenium Quickstart Documentation](https://testingbot.com/support/web-automate/selenium)
- [Selenium 4](https://testingbot.com/support/web-automate/selenium/selenium4)
- [Selenium BiDi](https://testingbot.com/support/web-automate/selenium/selenium-bidi)
- [CI/CD integration](https://testingbot.com/support/integrations/ci-cd)

[探索文档](https://testingbot.com/support)

### 企业级安全

STAR Level 1

Certified

GDPR

Compliant

SAML SSO

Single Sign-On

99.9%

Uptime SLA

[访问 TestingBot 信任中心](https://trust.testingbot.com/)

## 准备好加速你的Selenium测试了吗？

请参阅我们的[Selenium测试](https://testingbot.com/support/web-automate/selenium)文档，了解如何开始。

[开始免费试用](https://zh.testingbot.com/users/sign_up)

您可能喜欢的资源

[![Selenium and Generative AI](https://zh.testingbot.com/assets/resources/articles/28-af707bf052844eb00f861bb6ebba57e6be4479dde1c78a5df4e70d2f597a8b18.webp)](https://testingbot.com/resources/articles/generative-ai-selenium)
### [Selenium and Generative AI](https://testingbot.com/resources/articles/generative-ai-selenium)

Generate realistic looking test data to be used with your Selenium Automated Tests.

[阅读更多](https://testingbot.com/resources/articles/generative-ai-selenium)

[![Selenium 4: what's new](https://zh.testingbot.com/assets/blog/2021/se4.webp)](https://testingbot.com/blog/selenium-4)
### [Selenium 4: what's new](https://testingbot.com/blog/selenium-4)

Learn more about what is new Selenium 4.

[阅读更多](https://testingbot.com/blog/selenium-4)

[![Selenium WebDriver BiDi](https://zh.testingbot.com/assets/blog/2024/bidi.webp)](https://testingbot.com/blog/webdriver-bidi)
### [Selenium WebDriver BiDi](https://testingbot.com/blog/webdriver-bidi)

WebDriver BiDi support is now available on TestingBot. Learn how to use this exciting new improvement with your Selenium tests.

[阅读更多](https://testingbot.com/blog/webdriver-bidi)
