Skip to content

Commit f39d357

Browse files
alaahongdiemol
andauthored
SeleniumHQ#891 Update locators (SeleniumHQ#947) [deploy site]
1. Update the content of locators on the XPath usage of linkText and partialLinkText 2. Update Chinese translation of "locators" Co-authored-by: Diego Molina <[email protected]>
1 parent 6ef2eb4 commit f39d357

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

website_and_docs/content/documentation/test_practices/encouraged/locators.en.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ not performance tested by browser vendors and tend to be quite slow.
2121

2222
Selection strategies based on _linkText_ and _partialLinkText_ have
2323
drawbacks in that they only work on link elements. Additionally, they
24-
call down to XPath selectors internally in WebDriver.
24+
call down to [querySelectorAll](https://www.w3.org/TR/webdriver/#link-text) selectors internally in WebDriver.
2525

2626
Tag name can be a dangerous way to locate elements. There are
2727
frequently multiple elements of the same tag present on the page.

website_and_docs/content/documentation/test_practices/encouraged/locators.ja.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ XPathはCSSセレクタと同様に動作しますが、シンタックスは複
1717
XPathはとても柔軟ですが、ブラウザベンダは性能テストを通常行っておらず、非常に動作が遅い傾向があります。
1818

1919
link textセレクタとpartial _linkText_ セレクタはa要素でしか動作しないという欠点があります。
20-
加えて、これらはWebDriverの内部でXPathの呼び出しに置き換えられます
20+
加えて、これらはWebDriverの内部で[querySelectorAll](https://www.w3.org/TR/webdriver/#link-text)の呼び出しに置き換えられます
2121

2222
タグ名によるロケータは危険な方法になり得ます。
2323
大抵の場合ページ上には同じタグ名の要素が複数あります。タグ名は要素のコレクションを返す _findElements(By)_ メソッドを使う時にもっとも役に立ちます。

website_and_docs/content/documentation/test_practices/encouraged/locators.pt-br.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ depurar. Embora os seletores XPath sejam muito flexíveis, eles não são tipica
2121

2222
As estratégias de seleção baseadas em _linkText_ e _partialLinkText_ têm
2323
desvantagens porque eles só funcionam em elementos de link. Além disso, eles
24-
chamam seletores XPath internamente no WebDriver.
24+
chamam seletores [querySelectorAll](https://www.w3.org/TR/webdriver/#link-text) internamente no WebDriver.
2525

2626
O nome da tag pode ser uma maneira perigosa de localizar elementos. tem
2727
frequentemente, vários elementos da mesma tag presentes na página.

website_and_docs/content/documentation/test_practices/encouraged/locators.zh-cn.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
title: "使用定位器的提示"
33
linkTitle: "定位器"
44
weight: 8
5-
needsTranslation: true
65
description: >
7-
何时使用哪些定位器以及如何在代码中最好地管理它们.
6+
何时使用哪些定位器以及如何在代码中最好地管理它们.
87
---
98

10-
Take a look at examples of the [supported locator strategies]({{< ref "/documentation/webdriver/elements/locators.md" >}}).
9+
这里有一些 [支持的定位策略]({{< ref "/documentation/webdriver/elements/locators.md" >}}) 的例子 .
1110

1211
一般来说,如果 HTML 的 id 是可用的、唯一的且是可预测的,那么它就是在页面上定位元素的首选方法。它们的工作速度非常快,可以避免复杂的 DOM 遍历带来的大量处理。
1312

1413
如果没有唯一的 id,那么最好使用写得好的 CSS 选择器来查找元素。XPath 和 CSS 选择器一样好用,但是它语法很复杂,并且经常很难调试。尽管 XPath 选择器非常灵活,但是他们通常未经过浏览器厂商的性能测试,并且运行速度很慢。
1514

16-
基于链接文本和部分链接文本的选择策略有其缺点,即只能对链接元素起作用。此外,它们在 WebDriver 内部调用 XPath 选择器。
15+
基于链接文本和部分链接文本的选择策略有其缺点,即只能对链接元素起作用。此外,它们在 WebDriver 内部调用 [querySelectorAll](https://www.w3.org/TR/webdriver/#link-text) 选择器。
1716

1817
标签名可能是一种危险的定位元素的方法。页面上经常出现同一标签的多个元素。这在调用 _findElements(By)_ 方法返回元素集合的时候非常有用。
1918

0 commit comments

Comments
 (0)