Skip to content

Commit cc2fbff

Browse files
Merge branch 'trunk' into patch-1
2 parents 70568f6 + 32521ad commit cc2fbff

8 files changed

Lines changed: 64 additions & 61 deletions

File tree

.github/workflows/link-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
args: website_and_docs/public/ --check-anchors
5252

5353
- name: Archive hyperlink results
54-
uses: actions/upload-artifact@v5
54+
uses: actions/upload-artifact@v6
5555
with:
5656
name: hyperlink-report
5757
path: website_and_docs/tmp/.hyperlink/hyperlink.log

.github/workflows/lock.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
action:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: dessant/lock-threads@v5
17+
- uses: dessant/lock-threads@v6
1818
with:
1919
process-only: 'issues'
2020
issue-lock-inactive-days: '30'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2025 Software Freedom Conservancy (SFC)
190+
Copyright 2026 Software Freedom Conservancy (SFC)
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: "查询网络元素"
33
linkTitle: "查询器"
44
weight: 2
5-
needsTranslation: true
65
aliases: [
76
"/documentation/zh-cn/webdriver/locating_elements/",
87
"/zh-cn/documentation/webdriver/locating_elements/"
@@ -11,11 +10,11 @@ description: >
1110
根据提供的定位值定位元素.
1211
---
1312

14-
One of the most fundamental aspects of using Selenium is obtaining element references to work with.
15-
Selenium offers a number of built-in [locator strategies]({{< ref "locators.md" >}}) to uniquely identify an element.
16-
There are many ways to use the locators in very advanced scenarios. For the purposes of this documentation,
17-
let's consider this HTML snippet:
1813

14+
使用 Selenium 最基本的特点之一是获取可用于操作的元素引用。
15+
Selenium 提供了许多内置的 [定位策略]({{< ref "locators.md" >}}),用于唯一标识元素。
16+
在更复杂的场景中,可以用多种方式使用这些定位器。为了本篇文档的目的,
17+
我们来考虑下面的 HTML 片段:
1918

2019
```html
2120
<ol id="vegetables">
@@ -30,17 +29,18 @@ let's consider this HTML snippet:
3029
</ul>
3130
```
3231

33-
## First matching element
32+
## 第一个匹配的元素
3433

35-
Many locators will match multiple elements on the page. The singular find element method will return a reference to the
36-
first element found within a given context.
34+
许多定位器会匹配页面上的多个元素。
35+
单个的 find element 方法会返回在给定上下文中找到的第一个元素的引用。
3736

38-
### Evaluating entire DOM
37+
### 在整个 DOM 中查找
3938

40-
When the find element method is called on the driver instance, it
41-
returns a reference to the first element in the DOM that matches with the provided locator.
42-
This value can be stored and used for future element actions. In our example HTML above, there are
43-
two elements that have a class name of "tomatoes" so this method will return the element in the "vegetables" list.
39+
当在 driver 实例上调用 find element 方法时,
40+
它会返回 DOM 中与所提供定位器匹配的第一个元素的引用。
41+
该引用可以被保存并用于后续的元素操作。
42+
在上面的示例 HTML 中,有两个 class 名称为 "tomatoes" 的元素,
43+
因此此方法会返回位于 "vegetables" 列表中的那个元素。
4444

4545
{{< tabpane langEqualsHeader=true >}}
4646
{{< tab header="Java" >}}
@@ -64,14 +64,17 @@ val vegetable: WebElement = driver.findElement(By.className("tomatoes"))
6464
{{< /tabpane >}}
6565

6666

67-
### Evaluating a subset of the DOM
6867

69-
Rather than finding a unique locator in the entire DOM, it is often useful to narrow the search to the scope
70-
of another located element. In the above example there are two elements with a class name of "tomatoes" and
71-
it is a little more challenging to get the reference for the second one.
68+
### 在 DOM 的子集内评估
7269

73-
One solution is to locate an element with a unique attribute that is an ancestor of the desired element and not an
74-
ancestor of the undesired element, then call find element on that object:
70+
与其在整个 DOM 中寻找唯一的定位器,
71+
通常更有用的是将搜索范围缩小到另一个已定位元素的作用域内。
72+
在上面的示例中,有两个 class 名为 "tomatoes" 的元素,
73+
因此要获取第二个元素的引用会更具挑战性。
74+
75+
一种解决办法是先定位一个具有唯一属性的元素,
76+
该元素是目标元素的祖先但不是非目标元素的祖先,
77+
然后在该对象上调用 `find element`
7578

7679
{{< tabpane langEqualsHeader=true >}}
7780
{{< tab header="Java" >}}
@@ -100,18 +103,16 @@ val fruit = fruits.findElement(By.className("tomatoes"))
100103
{{< /tabpane >}}
101104

102105
{{% pageinfo color="info" %}}
103-
**Java and C#**<br>
104-
`WebDriver`, `WebElement` and `ShadowRoot` classes all implement a `SearchContext` interface, which is
105-
considered a _role-based interface_. Role-based interfaces allow you to determine whether a particular
106-
driver implementation supports a given feature. These interfaces are clearly defined and try
107-
to adhere to having only a single role of responsibility.
106+
**Java 和 C#**<br>
107+
`WebDriver``WebElement``ShadowRoot` 类都实现了 `SearchContext` 接口,
108+
该接口被视为一种 _基于角色的接口_。基于角色的接口可以让你判断特定的驱动实现是否支持某项功能。
109+
这些接口定义清晰,并尽量遵循单一职责原则。
108110
{{% /pageinfo %}}
109111

110-
### Evaluating the Shadow DOM
112+
### 评估 Shadow DOM
111113

112-
The Shadow DOM is an encapsulated DOM tree hidden inside an element.
113-
With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree
114-
with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater.
114+
Shadow DOM 是隐藏在元素内部的封装 DOM 树。
115+
自 Chromium 浏览器在 v96 发布后,Selenium 已支持通过易用的 shadow root 方法访问该树。注意:这些方法需要 Selenium 4.0 或更高版本。
115116

116117
{{< tabpane langEqualsHeader=true >}}
117118
{{< badge-examples >}}
@@ -143,16 +144,16 @@ shadow_content = shadow_root.find_element(css: '#shadow_content')
143144
{{< /tab >}}
144145
{{< /tabpane >}}
145146

146-
### Optimized locator
147+
### 优化后的定位器
147148

148-
A nested lookup might not be the most effective location strategy since it requires two
149-
separate commands to be issued to the browser.
149+
嵌套查找可能不是最有效的定位策略,
150+
因为它需要向浏览器发送两次独立的命令。
150151

151-
To improve the performance slightly, we can use either CSS or XPath to find this element in a single command.
152-
See the [Locator strategy suggestions]({{< ref "/documentation/test_practices/encouraged/locators" >}}) in our
153-
[Encouraged test practices]({{< ref "/documentation/test_practices/encouraged" >}}) section.
152+
为略微提升性能,我们可以使用 CSS XPath,在一次命令中定位到该元素。
153+
请参阅本节中关于[定位策略建议]({{< ref "/documentation/test_practices/encouraged/locators" >}})的说明
154+
以及[推荐的测试实践]({{< ref "/documentation/test_practices/encouraged" >}})
154155

155-
For this example, we'll use a CSS Selector:
156+
在本例中,我们将使用 CSS 选择器:
156157

157158
{{< tabpane langEqualsHeader=true >}}
158159
{{< tab header="Java" >}}
@@ -176,12 +177,12 @@ val fruit = driver.findElement(By.cssSelector("#fruits .tomatoes"))
176177
{{< /tabpane >}}
177178

178179

179-
## All matching elements
180180

181-
There are several use cases for needing to get references to all elements that match a locator, rather
182-
than just the first one. The plural find elements methods return a collection of element references.
183-
If there are no matches, an empty list is returned. In this case,
184-
references to all fruits and vegetable list items will be returned in a collection.
181+
## 所有匹配的元素
182+
183+
在某些情况下,需要获取与定位器匹配的所有元素的引用,而不是仅获取第一个。
184+
复数形式的 `find elements` 方法会返回一组元素引用。如果没有匹配项,则返回空列表。
185+
在本例中,将返回所有水果和蔬菜列表项的引用集合。
185186

186187
{{< tabpane langEqualsHeader=true >}}
187188
{{< tab header="Java" >}}
@@ -204,9 +205,9 @@ val plants: List<WebElement> = driver.findElements(By.tagName("li"))
204205
{{< /tab >}}
205206
{{< /tabpane >}}
206207

207-
### Get element
208-
Often you get a collection of elements but want to work with a specific element, which means you
209-
need to iterate over the collection and identify the one you want.
208+
### 获取元素
209+
有时你会得到一组元素,但想操作其中某个特定元素,
210+
这意味着需要遍历该集合并找到目标元素。
210211

211212

212213
{{< tabpane langEqualsHeader=true >}}
@@ -300,10 +301,10 @@ fun main() {
300301
{{< /tab >}}
301302
{{< /tabpane >}}
302303

303-
## Find Elements From Element
304+
## 从元素查找子元素
304305

305-
It is used to find the list of matching child WebElements within the context of parent element.
306-
To achieve this, the parent WebElement is chained with 'findElements' to access child elements
306+
用于在父元素的上下文中查找匹配的子 WebElement 列表。
307+
为此,可在父 WebElement 上链式调用 `findElements` 来访问子元素。
307308

308309
{{< tabpane langEqualsHeader=true >}}
309310
{{< tab header="Java" >}}
@@ -434,9 +435,9 @@ namespace FindElementsFromElement {
434435
{{< /tab >}}
435436
{{< /tabpane >}}
436437

437-
## Get Active Element
438+
## 获取活动元素
438439

439-
It is used to track (or) find DOM element which has the focus in the current browsing context.
440+
用于跟踪或查找当前浏览上下文中具有焦点的 DOM 元素。
440441

441442
{{< tabpane langEqualsHeader=true >}}
442443
{{< tab header="Java" >}}

website_and_docs/content/documentation/webdriver/interactions/frames.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ aliases: [
1616

1717
```html
1818
<div id="modal">
19-
<iframe id="buttonframe"name="myframe"src="https://seleniumhq.github.io">
19+
<iframe id="buttonframe" name="myframe" src="https://seleniumhq.github.io">
2020
<button>Click here</button>
2121
</iframe>
2222
</div>

website_and_docs/content/project/structure/_index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ <h3 class="pb-3">Selenium Committers</h3>
5858
{{< gh-user "https://api.github.com/users/adamgoucher" >}}
5959
{{< gh-user "https://api.github.com/users/aguspe" >}}
6060
{{< gh-user "https://api.github.com/users/andreastt" >}}
61+
{{< gh-user "https://api.github.com/users/asolntsev" >}}
6162
{{< gh-user "https://api.github.com/users/AutomatedTester" >}}
6263
{{< gh-user "https://api.github.com/users/barancev" >}}
6364
{{< gh-user "https://api.github.com/users/bonigarcia" >}}
@@ -94,6 +95,7 @@ <h3 class="pb-3">Selenium Committers</h3>
9495
{{< gh-user "https://api.github.com/users/paul-hammant" >}}
9596
{{< gh-user "https://api.github.com/users/p0deje" >}}
9697
{{< gh-user "https://api.github.com/users/pujagani" >}}
98+
{{< gh-user "https://api.github.com/users/RenderMichael" >}}
9799
{{< gh-user "https://api.github.com/users/santiycr" >}}
98100
{{< gh-user "https://api.github.com/users/sevaseva" >}}
99101
{{< gh-user "https://api.github.com/users/shbenzer" >}}

website_and_docs/layouts/downloads/list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div class="card-body">
2626
<p class="card-text">
2727
Latest stable version
28-
<a href="https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.38.0/selenium-server-4.38.0.jar">4.38.0</a>
28+
<a href="https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.40.0/selenium-server-4.40.0.jar">4.40.0</a>
2929
</p>
3030
<p class="card-text">
3131
To use the Selenium Server in a Grid configuration, see the
@@ -115,7 +115,7 @@ <h2 class="card-title">
115115
<div class="card-body">
116116
<h2 class="card-title">C# NuGet</h2>
117117
<p class="card-text w-lg-75">
118-
Nuget latest release is 4.38.0 Released on October 25, 2025.
118+
Nuget latest release is 4.40.0 Released on January 18, 2026.
119119
</p>
120120
<ul>
121121
<li>

website_and_docs/layouts/partials/selenium-clients-and-webdriver-bindings.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h2 id="bindings" class="card-title">Selenium Clients and WebDriver Language Bin
2727
<p class="card-text m-0 pb-1">
2828
Stable:
2929
<a href="https://www.nuget.org/packages/Selenium.WebDriver" class="card-link">
30-
4.38.0 (October 25, 2025)
30+
4.40.0 (January 18, 2026)
3131
</a>
3232
</p>
3333
<p class="card-text m-0 pb-1">
@@ -54,8 +54,8 @@ <h2 id="bindings" class="card-title">Selenium Clients and WebDriver Language Bin
5454
</p>
5555
<p class="card-text m-0 pb-1">
5656
Stable:
57-
<a href="https://rubygems.org/gems/selenium-webdriver/versions/4.38.0" class="card-link">
58-
4.38.0 (October 25, 2025)
57+
<a href="https://rubygems.org/gems/selenium-webdriver/versions/4.40.0" class="card-link">
58+
4.40.0 (January 18, 2026)
5959
</a>
6060
</p>
6161
<p class="card-text m-0 pb-1">
@@ -82,8 +82,8 @@ <h2 id="bindings" class="card-title">Selenium Clients and WebDriver Language Bin
8282
</p>
8383
<p class="card-text m-0 pb-1">
8484
Stable:
85-
<a href="https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.38.0/selenium-java-4.38.0.zip" class="card-link">
86-
4.38.0 (October 25, 2025)
85+
<a href="https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.40.0/selenium-java-4.40.0.zip" class="card-link">
86+
4.40.0 (January 18, 2026)
8787
</a>
8888
</p>
8989
<p class="card-text m-0 pb-1">
@@ -111,7 +111,7 @@ <h2 id="bindings" class="card-title">Selenium Clients and WebDriver Language Bin
111111
<p class="card-text m-0 pb-1">
112112
Stable:
113113
<a href="https://pypi.python.org/pypi/selenium" class="card-link">
114-
4.38.0 (October 25, 2025)
114+
4.40.0 (January 18, 2026)
115115
</a>
116116
</p>
117117
<p class="card-text m-0 pb-1">
@@ -139,7 +139,7 @@ <h2 id="bindings" class="card-title">Selenium Clients and WebDriver Language Bin
139139
<p class="card-text m-0 pb-1">
140140
Stable:
141141
<a href="https://npmjs.org/package/selenium-webdriver" class="card-link">
142-
4.38.0 (October 25, 2025)
142+
4.40.0 (January 18, 2026)
143143
</a>
144144
</p>
145145
<p class="card-text m-0 pb-1">

0 commit comments

Comments
 (0)