Skip to content

Commit 6bf44a8

Browse files
authored
Finished translating finders.pt-br.md to Brazilian Portuguese (#1051)
Finished translating the entire page located at website_and_docs/content/documentation/webdriver/finders.pt-br.md to Brazilian Portuguese. [deploy site]
1 parent 3ec4cc6 commit 6bf44a8

File tree

1 file changed

+77
-82
lines changed

1 file changed

+77
-82
lines changed

website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md

Lines changed: 77 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Finding web elements"
2+
title: "Encontrando Elementos Web"
33
linkTitle: "Finders"
44
weight: 2
55
needsTranslation: true
@@ -8,39 +8,37 @@ aliases: [
88
"/pt-br/documentation/webdriver/locating_elements/"
99
]
1010
description: >
11-
Locating the elements based on the provided locator values.
11+
Localizando elementos com base nos valores providenciados pelo localizador.
1212
---
13-
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:
13+
Um dos aspectos mais fundamentais do uso do Selenium é obter referências de elementos para trabalhar.
14+
O Selenium oferece várias [estratégias de localizador]({{< ref "locators.md" >}}) para identificar exclusivamente um elemento.
15+
Há muitas maneiras de usar os localizadores em cenários complexos. Para os propósitos desta documentação,
16+
vamos considerar este trecho de HTML:
1817

1918

2019
```html
2120
<ol id="vegetables">
2221
<li class="potatoes">…
2322
<li class="onions">…
24-
<li class="tomatoes"><span>Tomato is a Vegetable</span>…
23+
<li class="tomatoes"><span>O tomate é um vegetal</span>…
2524
</ol>
2625
<ul id="fruits">
2726
<li class="bananas">…
2827
<li class="apples">…
29-
<li class="tomatoes"><span>Tomato is a Fruit</span>…
28+
<li class="tomatoes"><span>O tomate é uma fruta</span>…
3029
</ul>
3130
```
3231

33-
## First matching element
34-
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.
37-
38-
### Evaluating entire DOM
32+
## Primeiro Elemento correspondente
33+
Muitos localizadores irão corresponder a vários elementos na página.
34+
O método de elemento de localização singular retornará uma referência ao
35+
primeiro elemento encontrado dentro de um determinado contexto.
3936

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.
37+
### Avaliando o DOM inteiro
38+
Quando o metodo find element é chamado na instância do driver, ele
39+
retorna uma referência ao primeiro elemento no DOM que corresponde ao localizador fornecido.
40+
Esse valor pode ser guardado e usado para ações futuras do elemento. Em nosso exemplo HTML acima, existem
41+
dois elementos que têm um nome de classe de "tomatoes" então este método retornará o elemento na lista "vegetables".
4442

4543
{{< tabpane langEqualsHeader=true >}}
4644
{{< tab header="Java" >}}
@@ -64,14 +62,13 @@ val vegetable: WebElement = driver.findElement(By.className("tomatoes"))
6462
{{< /tabpane >}}
6563

6664

67-
### Evaluating a subset of the DOM
65+
### Avaliando um subconjunto do DOM
66+
Ao em vez de tentar encontrar um localizador unico no DOM inteiro, normalmente é útil restringir a busca ao escopo de outro elemento
67+
já localizado. No exemplo acima existem dois elementos com um nome de classe de "tomatoes" e
68+
é um pouco mais desafiador obter a referência para o segundo.
6869

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.
72-
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+
Uma possível solução seria localizar um elemento com um atributo único que seja um ancestral do elemento desejado e não um
71+
ancestral do elemento indesejado, então invoque o find element nesse objeto:
7572

7673
{{< tabpane langEqualsHeader=true >}}
7774
{{< tab header="Java" >}}
@@ -101,23 +98,22 @@ val fruit = fruits.findElement(By.id("tomatoes"))
10198
{{< /tabpane >}}
10299

103100
{{% pageinfo color="info" %}}
104-
**Java and C#**<br>
105-
`WebDriver`, `WebElement` and `ShadowRoot` classes all implement a `SearchContext` interface, which is
106-
considered a _role-based interface_. Role-based interfaces allow you to determine whether a particular
107-
driver implementation supports a given feature. These interfaces are clearly defined and try
108-
to adhere to having only a single role of responsibility.
101+
**Java e C#**<br>
102+
As classes `WebDriver`, `WebElement` e `ShadowRoot` todas implementam o `SearchContext` interface, que é
103+
considerada uma _role-based interface_(interface baseada em função). As interfaces baseadas em função permitem determinar se uma determinada
104+
implementação de driver suporta um recurso específico. Essas interfaces são claramente definidas e tentam
105+
aderir a ter apenas um único papel de responsabilidade.
109106
{{% /pageinfo %}}
110107

111-
### Optimized locator
112-
113-
A nested lookup might not be the most effective location strategy since it requires two
114-
separate commands to be issued to the browser.
108+
### Localizador otimizado
109+
Uma pesquisa aninhada pode não ser a estratégia de localização mais eficaz, pois requer dois
110+
comandos separados a serem emitidos para o navegador.
115111

116-
To improve the performance slightly, we can use either CSS or XPath to find this element in a single command.
117-
See the [Locator strategy suggestions]({{< ref "/documentation/test_practices/encouraged/locators" >}}) in our
118-
[Encouraged test practices]({{< ref "/documentation/test_practices/encouraged" >}}) section.
112+
Para melhorar um pouco o desempenho, podemos usar CSS ou XPath para encontrar esse elemento com um único comando.
113+
Veja as [sugestões de estratégia do localizador]({{< ref "/documentation/test_practices/encouraged/locators" >}}) na nossa sessão de
114+
[Práticas de teste incentivadas]({{< ref "/documentation/test_practices/encouraged" >}}).
119115

120-
For this example, we'll use a CSS Selector:
116+
Para esse exemplo, utilizaremos o CSS Selector:
121117

122118
{{< tabpane langEqualsHeader=true >}}
123119
{{< tab header="Java" >}}
@@ -141,12 +137,11 @@ val fruit = driver.findElement(By.cssSelector("#fruits .tomatoes"))
141137
{{< /tabpane >}}
142138

143139

144-
## All matching elements
145-
146-
There are several use cases for needing to get references to all elements that match a locator, rather
147-
than just the first one. The plural find elements methods return a collection of element references.
148-
If there are no matches, an empty list is returned. In this case,
149-
references to all fruits and vegetable list items will be returned in a collection.
140+
## Todos os elementos correspondentes
141+
Existem vários casos de uso para a necessidade de obter referências a todos os elementos que correspondem a um localizador, em vez
142+
do que apenas o primeiro. Os métodos plurais find elements retornam uma coleção de referências de elementos.
143+
Se não houver correspondências, uma lista vazia será retornada. Nesse caso,
144+
referências a todos os itens da lista de frutas e vegetais serão devolvidas em uma coleção.
150145

151146
{{< tabpane langEqualsHeader=true >}}
152147
{{< tab header="Java" >}}
@@ -169,9 +164,9 @@ val plants: List<WebElement> = driver.findElements(By.tagName("li"))
169164
{{< /tab >}}
170165
{{< /tabpane >}}
171166

172-
### Get element
173-
Often you get a collection of elements but want to work with a specific element, which means you
174-
need to iterate over the collection and identify the one you want.
167+
### Obter Elemento
168+
Muitas vezes você obterá uma coleção de elementos, mas quer trabalhar apenas com um elemento específico, o que significa que você
169+
precisa iterar sobre a coleção e identificar o que você deseja.
175170

176171

177172
{{< tabpane langEqualsHeader=true >}}
@@ -188,10 +183,10 @@ from selenium.webdriver.common.by import By
188183

189184
driver = webdriver.Firefox()
190185

191-
# Navigate to Url
186+
# Navegar até a URL
192187
driver.get("https://www.example.com")
193188

194-
# Get all the elements available with tag name 'p'
189+
# Obtém todos os elementos disponiveis com o nome da tag 'p'
195190
elements = driver.find_elements(By.TAG_NAME, 'p')
196191

197192
for e in elements:
@@ -207,10 +202,10 @@ namespace FindElementsExample {
207202
public static void Main(string[] args) {
208203
IWebDriver driver = new FirefoxDriver();
209204
try {
210-
// Navigate to Url
205+
// Navegar até a URL
211206
driver.Navigate().GoToUrl("https://example.com");
212207

213-
// Get all the elements available with tag name 'p'
208+
// Obtém todos os elementos disponiveis com o nome da tag 'p'
214209
IList < IWebElement > elements = driver.FindElements(By.TagName("p"));
215210
foreach(IWebElement e in elements) {
216211
System.Console.WriteLine(e.Text);
@@ -227,10 +222,10 @@ namespace FindElementsExample {
227222
require 'selenium-webdriver'
228223
driver = Selenium::WebDriver.for :firefox
229224
begin
230-
# Navigate to URL
225+
# Navegar até a URL
231226
driver.get 'https://www.example.com'
232227

233-
# Get all the elements available with tag name 'p'
228+
# Obtém todos os elementos disponiveis com o nome da tag 'p'
234229
elements = driver.find_elements(:tag_name,'p')
235230

236231
elements.each { |e|
@@ -245,10 +240,10 @@ const {Builder, By} = require('selenium-webdriver');
245240
(async function example() {
246241
let driver = await new Builder().forBrowser('firefox').build();
247242
try {
248-
// Navigate to Url
243+
// Navegar até a URL
249244
await driver.get('https://www.example.com');
250245

251-
// Get all the elements available with tag 'p'
246+
// Obtém todos os elementos disponiveis com o nome da tag 'p'
252247
let elements = await driver.findElements(By.css('p'));
253248
for(let e of elements) {
254249
console.log(await e.getText());
@@ -267,7 +262,7 @@ fun main() {
267262
val driver = FirefoxDriver()
268263
try {
269264
driver.get("https://example.com")
270-
// Get all the elements available with tag name 'p'
265+
// Obtém todos os elementos disponiveis com o nome da tag 'p'
271266
val elements = driver.findElements(By.tagName("p"))
272267
for (element in elements) {
273268
println("Paragraph text:" + element.text)
@@ -279,10 +274,10 @@ fun main() {
279274
{{< /tab >}}
280275
{{< /tabpane >}}
281276

282-
## Find Elements From Element
277+
## Localizar Elementos em um Elemento
283278

284-
It is used to find the list of matching child WebElements within the context of parent element.
285-
To achieve this, the parent WebElement is chained with 'findElements' to access child elements
279+
Ele é usado para localizar a lista de WebElements filhos correspondentes dentro do contexto do elemento pai.
280+
Para realizar isso, o WebElement pai é encadeado com o 'findElements' para acessar seus elementos filhos.
286281

287282
{{< tabpane langEqualsHeader=true >}}
288283
{{< tab header="Java" >}}
@@ -298,10 +293,10 @@ To achieve this, the parent WebElement is chained with 'findElements' to access
298293
try {
299294
driver.get("https://example.com");
300295

301-
// Get element with tag name 'div'
296+
// Obtém o elemento com o nome da tag 'div'
302297
WebElement element = driver.findElement(By.tagName("div"));
303298

304-
// Get all the elements available with tag name 'p'
299+
// Obtém todos os elementos disponiveis com o nome da tag 'p'
305300
List<WebElement> elements = element.findElements(By.tagName("p"));
306301
for (WebElement e : elements) {
307302
System.out.println(e.getText());
@@ -319,10 +314,10 @@ from selenium.webdriver.common.by import By
319314
driver = webdriver.Chrome()
320315
driver.get("https://www.example.com")
321316

322-
# Get element with tag name 'div'
317+
# Obtém o elemento com o nome da tag 'div'
323318
element = driver.find_element(By.TAG_NAME, 'div')
324319

325-
# Get all the elements available with tag name 'p'
320+
# Obtém todos os elementos disponíveis com o nome da tag 'p'
326321
elements = element.find_elements(By.TAG_NAME, 'p')
327322
for e in elements:
328323
print(e.text)
@@ -339,10 +334,10 @@ namespace FindElementsFromElement {
339334
try {
340335
driver.Navigate().GoToUrl("https://example.com");
341336

342-
// Get element with tag name 'div'
337+
// Obtém o elemento com o nome da tag 'div'
343338
IWebElement element = driver.FindElement(By.TagName("div"));
344339

345-
// Get all the elements available with tag name 'p'
340+
// Obtém todos os elementos disponíveis com o nome da tag 'p'
346341
IList < IWebElement > elements = element.FindElements(By.TagName("p"));
347342
foreach(IWebElement e in elements) {
348343
System.Console.WriteLine(e.Text);
@@ -358,13 +353,13 @@ namespace FindElementsFromElement {
358353
require 'selenium-webdriver'
359354
driver = Selenium::WebDriver.for :chrome
360355
begin
361-
# Navigate to URL
356+
# Navegar até a URL
362357
driver.get 'https://www.example.com'
363358

364-
# Get element with tag name 'div'
359+
# Obtém o elemento com o nome da tag 'div'
365360
element = driver.find_element(:tag_name,'div')
366361

367-
# Get all the elements available with tag name 'p'
362+
# Obtém todos os elementos disponíveis com o nome da tag 'p'
368363
elements = element.find_elements(:tag_name,'p')
369364

370365
elements.each { |e|
@@ -384,10 +379,10 @@ namespace FindElementsFromElement {
384379

385380
await driver.get('https://www.example.com');
386381

387-
// Get element with tag name 'div'
382+
// Obtém o elemento com o nome da tag 'div'
388383
let element = driver.findElement(By.css("div"));
389384

390-
// Get all the elements available with tag name 'p'
385+
// Obtém todos os elementos disponíveis com o nome da tag 'p'
391386
let elements = await element.findElements(By.css("p"));
392387
for(let e of elements) {
393388
console.log(await e.getText());
@@ -403,10 +398,10 @@ namespace FindElementsFromElement {
403398
try {
404399
driver.get("https://example.com")
405400

406-
// Get element with tag name 'div'
401+
// Obtém o elemento com o nome da tag 'div'
407402
val element = driver.findElement(By.tagName("div"))
408403

409-
// Get all the elements available with tag name 'p'
404+
// Obtém todos os elementos disponíveis com o nome da tag 'p'
410405
val elements = element.findElements(By.tagName("p"))
411406
for (e in elements) {
412407
println(e.text)
@@ -418,9 +413,9 @@ namespace FindElementsFromElement {
418413
{{< /tab >}}
419414
{{< /tabpane >}}
420415

421-
## Get Active Element
416+
## Obter elemento ativo
422417

423-
It is used to track (or) find DOM element which has the focus in the current browsing context.
418+
Ele é usado para rastrear (ou) encontrar um elemento DOM que tem o foco no contexto de navegação atual.
424419

425420
{{< tabpane langEqualsHeader=true >}}
426421
{{< tab header="Java" >}}
@@ -434,7 +429,7 @@ It is used to track (or) find DOM element which has the focus in the current bro
434429
driver.get("http://www.google.com");
435430
driver.findElement(By.cssSelector("[name='q']")).sendKeys("webElement");
436431

437-
// Get attribute of current active element
432+
// Obter atributo do elemento atualmente ativo
438433
String attr = driver.switchTo().activeElement().getAttribute("title");
439434
System.out.println(attr);
440435
} finally {
@@ -451,7 +446,7 @@ It is used to track (or) find DOM element which has the focus in the current bro
451446
driver.get("https://www.google.com")
452447
driver.find_element(By.CSS_SELECTOR, '[name="q"]').send_keys("webElement")
453448

454-
# Get attribute of current active element
449+
# Obter atributo do elemento atualmente ativo
455450
attr = driver.switch_to.active_element.get_attribute("title")
456451
print(attr)
457452
{{< /tab >}}
@@ -464,11 +459,11 @@ It is used to track (or) find DOM element which has the focus in the current bro
464459
public static void Main(string[] args) {
465460
IWebDriver driver = new ChromeDriver();
466461
try {
467-
// Navigate to Url
462+
// Navegar até a URL
468463
driver.Navigate().GoToUrl("https://www.google.com");
469464
driver.FindElement(By.CssSelector("[name='q']")).SendKeys("webElement");
470465

471-
// Get attribute of current active element
466+
// Obter atributo do elemento atualmente ativo
472467
string attr = driver.SwitchTo().ActiveElement().GetAttribute("title");
473468
System.Console.WriteLine(attr);
474469
} finally {
@@ -485,7 +480,7 @@ It is used to track (or) find DOM element which has the focus in the current bro
485480
driver.get 'https://www.google.com'
486481
driver.find_element(css: '[name="q"]').send_keys('webElement')
487482

488-
# Get attribute of current active element
483+
# Obter atributo do elemento atualmente ativo
489484
attr = driver.switch_to.active_element.attribute('title')
490485
puts attr
491486
ensure
@@ -500,7 +495,7 @@ It is used to track (or) find DOM element which has the focus in the current bro
500495
await driver.get('https://www.google.com');
501496
await driver.findElement(By.css('[name="q"]')).sendKeys("webElement");
502497

503-
// Get attribute of current active element
498+
// Obter atributo do elemento atualmente ativo
504499
let attr = await driver.switchTo().activeElement().getAttribute("title");
505500
console.log(`${attr}`)
506501
})();
@@ -515,7 +510,7 @@ It is used to track (or) find DOM element which has the focus in the current bro
515510
driver.get("https://www.google.com")
516511
driver.findElement(By.cssSelector("[name='q']")).sendKeys("webElement")
517512

518-
// Get attribute of current active element
513+
// Obter atributo do elemento atualmente ativo
519514
val attr = driver.switchTo().activeElement().getAttribute("title")
520515
print(attr)
521516
} finally {

0 commit comments

Comments
 (0)