From 435e1f705969a1de211db53ec8b4657cf3cc5780 Mon Sep 17 00:00:00 2001 From: Ivan Rodriguez Date: Sun, 22 Mar 2020 01:09:34 +0100 Subject: [PATCH 1/2] Add spanish translation to sites - Add spanish translation to locating elements - Add spanish translation to WebDriver index - Improve translation in driver rquirements --- .../locating_elements.es.md | 173 +++++++++--------- .../content/webdriver/_index.es.md | 29 ++- .../webdriver/driver_requirements.es.md | 12 +- 3 files changed, 102 insertions(+), 112 deletions(-) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.es.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.es.md index 15343252a195..3ba96517c70c 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.es.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.es.md @@ -1,19 +1,14 @@ --- -title: "Locating elements" +title: "Localizando elementos" weight: 3 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +### Localizando un elemento -### Locating one element - -One of the most fundamental techniques to learn when using WebDriver is -how to find elements on the page. WebDriver offers a number of built-in selector -types, amongst them finding an element by its ID attribute: +Una de las técnicas más fundamentales para aprender al usar WebDriver +es cómo encontrar elementos en la página. WebDriver ofrece varios +tipos de selectores integrados, entre ellos encontrar un elemento por +su atributo ID: {{< code-tab >}} {{< code-panel language="java" >}} @@ -36,17 +31,19 @@ val cheese: WebElement = driver.findElement(By.id("cheese")) {{< / code-panel >}} {{< / code-tab >}} -As seen in the example, locating elements in WebDriver is done on the -`WebDriver` instance object. The `findElement(By)` method returns -another fundamental object type, the `WebElement`. +Como se ve en el ejemplo, localizar elementos en WebDriver +se realiza en la instancia del objeto `WebDriver`. El método +`findElement(By)` devuelve otro tipo de objeto fundamental, +el `WebElement`. -* `WebDriver` represents the browser -* `WebElement` represents a particular DOM node - (a control, e.g. a link or input field, etc.) +* `WebDriver` representa el navegador +* `WebElement` representa un +nodo particular del DOM (un control, por ejemplo un enlace o campo de +entrada, etc.) -Once you have a reference to a web element that's been “found”, -you can narrow the scope of your search -by using the same call on that object instance: +Una vez que tengas una referencia a un elemento web que se ha +"encontrado", puedes reducir el alcance de tu búsqueda utilizando la +misma llamada en la instancia de ese objeto: {{< code-tab >}} {{< code-panel language="java" >}} @@ -75,28 +72,25 @@ val cheddar = cheese.findElement(By.id("cheddar")) {{< / code-panel >}} {{< / code-tab >}} -You can do this because both the _WebDriver_ and _WebElement_ types -implement the [_SearchContext_](//seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/SearchContext.html) -interface. In WebDriver, this is known as a _role-based interface_. -Role-based interfaces allow you to determine whether a particular -driver implementation supports a given feature. These interfaces are -clearly defined and try to adhere to having only a single role of -responsibility. You can read more about WebDriver's design and what -roles are supported in which drivers in the [Some Other Section Which -Must Be Named](#). +Puedes hacer esto porque los tipos _WebDriver_ y _WebElement_ +implementan la interfaz [_SearchContext_](//seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/SearchContext.html). +En WebDriver, esto se conoce como _interfaz basada en roles_. +Las interfaces basadas en roles te permiten determinar si +la implementación del controlador admite una característica dada. +Estas interfaces están claramente definidas y tratan de cumplir con +tener un solo rol de responsabilidad. Puede leer más sobre el diseño +de WebDriver y qué roles son compatibles con qué controladores en [Otra sección](#). -Consequently, the _By_ interface used above also supports a -number of additional locator strategies. A nested lookup might not be -the most effective cheese location strategy since it requires two -separate commands to be issued to the browser; first searching the DOM -for an element with ID “cheese”, then a search for “cheddar” in a -narrowed context. +En consecuencia, la interfaz _By_ utilizada anteriormente también permite una serie de +estrategias adicionales de localización. Una búsqueda anidada podría no ser la +estrategia mas efectiva para localizar _cheese_ ya que requiere dos +comandos que se emitirán al navegador; primero buscando en el DOM un +elemento con ID "cheese", luego una búsqueda de "cheddar" en un contexto reducido. -To improve the performance slightly, we should try to use a more -specific locator: WebDriver supports looking up elements -by CSS locators, allowing us to combine the two previous locators into -one search: +Para mejorar ligeramente el rendimiento, deberíamos intentar utilizar un +localizador más específico: WebDriver permite buscar elementos por localizadores CSS, +lo que nos permite combinar los dos localizadores anteriores en una sola búsqueda: {{< code-tab >}} {{< code-panel language="java" >}} @@ -119,10 +113,10 @@ driver.findElement(By.cssSelector("#cheese #cheddar")) {{< / code-panel >}} {{< / code-tab >}} -### Locating multiple elements +### Localizando múltiples elementos -It is possible that the document we are working with may turn out to have an -ordered list of the cheese we like the best: +Es posible que el documento con el que estamos trabajando contenga +una lista ordenada del queso que más nos gusta: ```html
    @@ -132,15 +126,13 @@ ordered list of the cheese we like the best:
  1. … ``` - -Since more cheese is undisputably better, and it would be cumbersome -to have to retrieve each of the items individually, a superior -technique for retrieving cheese is to make use of the pluralized -version `findElements(By)`. This method returns a collection of web -elements. If only one element is found, it will still return a -collection (of one element). If no element matches the locator, an -empty list will be returned. - +Dado que más queso es indiscutiblemente mejor, y sería engorroso +tener que recuperar cada uno de los elementos individualmente, +una técnica superior para recuperar _cheese_ es hacer uso de la +versión pluralizada `findElements(By)`. Este método devuelve una +colección de elementos web. Si solo se encuentra un elemento, aún devolverá una +colección (de un elemento). Si ningún elemento coincide con el localizador, +se devolverá la lista vacía. {{< code-tab >}} {{< code-panel language="java" >}} List muchoCheese = driver.findElements(By.cssSelector("#cheese li")); @@ -162,44 +154,47 @@ val muchoCheese: List = driver.findElements(By.cssSelector("#cheese {{< / code-panel >}} {{< / code-tab >}} -### Element selection strategies +### Estrategias de localización de elementos -There are eight different built-in element location strategies in WebDriver: +Hay ocho estrategias diferentes de ubicación de elementos integradas en WebDriver: -| Locator | Description | +| Localizador | Descripción | | -------- | ---------- | -| class name | Locates elements whose class name contains the search value (compound class names are not permitted) | -| css selector | Locates elements matching a CSS selector | -| id | Locates elements whose ID attribute matches the search value | -| name | Locates elements whose NAME attribute matches the search value | -| link text | Locates anchor elements whose visible text matches the search value | -| partial link text | Locates anchor elements whose visible text contains the search value. If multiple elements are matching, only the first one will be selected. | -| tag name | Locates elements whose tag name matches the search value | -| xpath | Locates elements matching an XPath expression | - -### Tips on using selectors - -In general, if HTML IDs are available, unique, and consistently -predictable, they are the preferred method for locating an element on -a page. They tend to work very quickly, and forego much processing -that comes with complicated DOM traversals. - -If unique IDs are unavailable, a well-written CSS selector is the -preferred method of locating an element. XPath works as well as CSS -selectors, but the syntax is complicated and frequently difficult to -debug. Though XPath selectors are very flexible, they are typically -not performance tested by browser vendors and tend to be quite slow. - -Selection strategies based on link text and partial link text have -drawbacks in that they only work on link elements. Additionally, they -call down to XPath selectors internally in WebDriver. - -Tag name can be a dangerous way to locate elements. There are -frequently multiple elements of the same tag present on the page. -This is mostly useful when calling the _findElements(By)_ method which -returns a collection of elements. - -The recommendation is to keep your locators as compact and -readable as possible. Asking WebDriver to traverse the DOM structure -is an expensive operation, and the more you can narrow the scope of -your search, the better. +| class name | Localiza elementos en el que el nombre de su clase contiene el valor de la búsqueda (no se permiten nombres de clase compuestos) | +| css selector | Localiza elementos que coinciden con un selector CSS | +| id | Localiza elementos cuyo atributo ID coincide con el valor de la búsqueda | +| name | Localiza elementos cuyo atributo NAME coincide con el valor de la búsqueda | +| link text | Localiza elementos de anclaje cuyo texto visible coincide con el valor de búsqueda | +| partial link text | Localiza elementos de anclaje cuyo texto visible coincide con el valor de búsqueda. Si varios elementos coinciden, solo se seleccionará el primero. | +| tag name | Localiza elementos cuyo nombre de etiqueta (tagName) coincide con el valor de búsqueda | +| xpath | Localiza elementos que coinciden con una expresión XPath | + +### Consejos sobre el uso de selectores + +En general, si los ID del HTML están disponibles, son únicos y +consistentemente predecibles, son el método preferido para ubicar un +elemento en una página. Tienden a trabajar muy rápido y renuncian al +mucho procesamiento que viene con recorridos DOM complicados. + +Si las ID únicas no están disponibles, un selector CSS bien escrito +es el método preferido para localizar un elemento. XPath funciona tan +bien como los selectores CSS, pero la sintaxis es complicada y con +frecuencia difícil de depurar. Aunque los selectores XPath son muy +flexibles, generalmente su desempeño no es probado por lo proveedores +de navegadores y tienden a ser bastante lentos. + +Las estrategias de selección basadas en enlaces de texto y enlaces de +texto parciales tienen el inconveniente en que solo funcionan en +elementos de enlace. Además, internamente en WebDriver llaman a los +selectores XPath. + +El nombre de la etiqueta puede ser una forma peligrosa de localizar +elementos. Existen frecuentemente múltiples elementos con la misma +etiqueta presentes en la página. Esto es mayormente útil cuando se +llama al método _findElements(By)_ que devuelve una colección de +elementos. + +La recomendación es mantener tus localizadores tan compactos y +legibles como sea posible. Pedirle a WebDriver que atraviese la +estructura del DOM es una operación costosa, y cuanto más se pueda +reducir el alcance de tu búsqueda, mejor. diff --git a/docs_source_files/content/webdriver/_index.es.md b/docs_source_files/content/webdriver/_index.es.md index 89cf3797cf71..b719e55b58ee 100644 --- a/docs_source_files/content/webdriver/_index.es.md +++ b/docs_source_files/content/webdriver/_index.es.md @@ -4,27 +4,22 @@ chapter: true weight: 5 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - # WebDriver -WebDriver drives a browser natively, as a user would, either locally -or on a remote machine using the Selenium server, -marks a leap forward in terms of browser automation. +WebDriver controla un navegador de forma nativa, como lo haría un +usuario, ya sea localmente o en una máquina remota utilizando el +servidor Selenium, marca un salto adelante en términos de +automatización de navegadores. -Selenium WebDriver refers to both the language bindings -and the implementations of the individual browser controlling code. -This is commonly referred to as just _WebDriver_. +Selenium WebDriver se refiere tanto a los enlaces de lenguajes como también +a las implementaciones individuales del código controlador del +navegador. Esto se conoce comúnmente solo como _WebDriver_. -Selenium WebDriver is a [W3C Recommendation](https://www.w3.org/TR/webdriver1/) +Selenium WebDriver es una [Recomendación W3C](https://www.w3.org/TR/webdriver1/) -* WebDriver is designed as a simple - and more concise programming interface. +* WebDriver está diseñado como una interfaz de programación +simple y más concisa. -* WebDriver is a compact object-oriented API. +* WebDriver es una API compacta orientada a objetos. -* It drives the browser effectively. +* Controla el navegador de manera efectiva. \ No newline at end of file diff --git a/docs_source_files/content/webdriver/driver_requirements.es.md b/docs_source_files/content/webdriver/driver_requirements.es.md index 4d2960aaab71..7c15cdaf0a8d 100644 --- a/docs_source_files/content/webdriver/driver_requirements.es.md +++ b/docs_source_files/content/webdriver/driver_requirements.es.md @@ -81,12 +81,12 @@ Puedes recuperar el control de la consola de comandos pulsando Ctrl + C Date: Sun, 22 Mar 2020 02:36:36 +0100 Subject: [PATCH 2/2] Add spanish translation to webdriver sites - Add translation to proxies page - Add translation to page loading strategy - Add translation to support classes - Add translation to web element --- .../content/webdriver/http_proxies.es.md | 36 ++--- .../webdriver/page_loading_strategy.es.md | 63 ++++---- .../content/webdriver/support_classes.es.md | 56 ++++--- .../content/webdriver/web_element.es.md | 146 +++++++++--------- 4 files changed, 146 insertions(+), 155 deletions(-) diff --git a/docs_source_files/content/webdriver/http_proxies.es.md b/docs_source_files/content/webdriver/http_proxies.es.md index 59acab82e962..3804c310f5d5 100644 --- a/docs_source_files/content/webdriver/http_proxies.es.md +++ b/docs_source_files/content/webdriver/http_proxies.es.md @@ -3,31 +3,25 @@ title: "Proxies Http" weight: 7 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +Un servidor proxy actúa como intermediario para +solicitudes entre un cliente y un servidor. En forma simple, +el tráfico fluye a través del servidor proxy +en camino a la dirección solicitada y de regreso. -A proxy server acts as an intermediary for -requests between a client and a server. In simple, -the traffic flows through the proxy server -on its way to the address you requested and back. +Un servidor proxy para scripts de automatización con +Selenium podría ser útil para: -A proxy server for automation scripts with -Selenium could be helpful for: +* Captura el tráfico de la red +* Simular llamadas de backend realizadas por el sitio web +* Accede al sitio web requerido bajo topologías de red complejas +o restricciones/políticas corporativas estrictas. -* Capture network traffic -* Mock backend calls made by the website -* Access the requited website under complex network -topologies or strict corporate restrictions/policies. +Si te encuentras en un entorno corporativo, y un +navegador no puede conectarse a una URL, esto es +muy probablemente porque el ambiente necesita un +proxy para acceder. -If you are in a corporate environment, and a -browser fails to connect to a URL, this is -most likely because the environment needs a -proxy to be accessed. - -Selenium WebDriver provides a way to proxy settings +Selenium WebDriver proporciona una via para configurar el proxy: {{< code-tab >}} {{< code-panel language="java" >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.es.md b/docs_source_files/content/webdriver/page_loading_strategy.es.md index 5a4cfe104205..570de9c76390 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.es.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.es.md @@ -3,41 +3,37 @@ title: "Estrategia de carga de página" weight: 8 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +Define la estrategia de carga de la página en la sesión actual. Por +defecto, cuando Selenium WebDriver carga una página, sigue la +pageLoadStrategy _normal_. Siempre se recomienda detener la descarga +de más recursos adicionales (como imágenes, css, js) cuando la carga +de la página lleva mucho tiempo. -Defines the current session's page loading strategy. -By default, when Selenium WebDriver loads a page, -it follows the _normal_ pageLoadStrategy. -It is always recommended to stop downloading additional -resources (like images, css, js) when the page loading takes lot of time. +La propiedad `document.readyState` de un documento describe el estado +de carga del documento actual. Por defecto, WebDriver esperará responder +a una llamada `driver.get()` (o) `driver.navigate().to()` hasta que el +estado de documento listo esté `completo` -The `document.readyState` property of a document describes the loading state of the current document. -By default, WebDriver will hold off on responding to a `driver.get()` (or) `driver.navigate().to()` -call until the document ready state is `complete` +En aplicaciones SPA (como Angular, react, Ember) una vez que el +contenido dinámico ya está cargado (es decir, una vez que el estado +de pageLoadStrategy es COMPLETO), hacer clic en un enlace o realizar +alguna acción dentro de la página no hará una nueva solicitud al +servidor ya que el contenido se carga dinámicamente en el lado del +cliente sin una actualización de la página. -In SPA applications (like Angular, react, Ember) once the dynamic content -is already loaded (I.e once the pageLoadStrategy status is COMPLETE), -clicking on a link or performing some action within the page will not make a new request -to the server as the content is dynamically loaded at the client side without a pull page refresh. +Las aplicaciones de SPA pueden cargar muchas vistas dinámicamente sin +ninguna solicitud del servidor, por lo que pageLoadStrategy siempre mostrará +el estado 'COMPLETO' hasta que hagamos un nuevo `driver.get()` y `driver.naviagte().to()` -SPA applications can load many views dynamically -without any server requests, So pageLoadStrategy -will always show `COMPLETE` status until -we do a new `driver.get()` and `driver.naviagte().to()` - -WebDriver _pageLoadStrategy_ supports the following values: +WebDriver _pageLoadStrategy_ permite los siguientes valores: ## normal -This will make Selenium WebDriver to wait for the entire page is loaded. -When set to **normal**, Selenium WebDriver waits until the -[load](https://developer.mozilla.org/es/docs/Web/Events/load) event fire is returned. +Esto hará que Selenium WebDriver espere a que se cargue toda la página. +Cuando se establece en **normal**, Selenium WebDriver espera hasta que se +dispare el evento [load](https://developer.mozilla.org/es/docs/Web/Events/load) y sea retornado. -By default **normal** is set to browser if none is provided. +Por defecto **normal** se establece en el navegador si no se proporciona ninguno. {{< code-tab >}} {{< code-panel language="java" >}} @@ -129,12 +125,13 @@ fun main() { ## eager -This will make Selenium WebDriver to wait until the -initial HTML document has been completely loaded and parsed, -and discards loading of stylesheets, images and subframes. +Esto hará que Selenium WebDriver espere hasta que +el documento HTML inicial se haya cargado y analizado por completo, +y descarta la carga de hojas de estilo, imágenes y sub marcos. -When set to **eager**, Selenium WebDriver waits until -[DOMContentLoaded](https://developer.mozilla.org/es/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. +Cuando se establece en **eager**, Selenium WebDriver espera +hasta que se dispare el evento +[DOMContentLoaded](https://developer.mozilla.org/es/docs/Web/API/Document/DOMContentLoaded_event) y sea retornado. {{< code-tab >}} {{< code-panel language="java" >}} @@ -233,7 +230,7 @@ fun main() { ## none -When set to **none** Selenium WebDriver only waits until the initial page is downloaded. +Cuando se establece en **none** Selenium WebDriver solo espera hasta que se descargue la página inicial. {{< code-tab >}} {{< code-panel language="java" >}} diff --git a/docs_source_files/content/webdriver/support_classes.es.md b/docs_source_files/content/webdriver/support_classes.es.md index 87074757754a..509cde629e9f 100644 --- a/docs_source_files/content/webdriver/support_classes.es.md +++ b/docs_source_files/content/webdriver/support_classes.es.md @@ -3,47 +3,43 @@ title: "Clases de apoyo" weight: 5 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -WebDriver support classes are provided to simplify maintaining your code. -They provide a nice abstraction to make modeling HTML element(s) as domain -objects easier, also providing helper methods to make using such objects easy to -reason about. We will learn about: - -* Locator Strategies -* Events +Las clases de soporte de WebDriver son proporcionadas para +simplificar el mantenimiento de tu código. Proporcionan una buena +abstracción para modelar mas fácilmente elementos HTML como objetos +de dominio, también proporcionando métodos de ayuda para hacer que el +uso de tales objetos sea fácil de razonar. Aprenderemos acerca de: + +* Estrategias de localizacion +* Eventos * LoadableComponent * ThreadGuard * etc. -Let's Start: +Iniciemos: ## **ThreadGuard** {{% notice info %}} -This class is only available in the Java Binding +Esta clase solo esta disponible en la librería de enlace de Java {{% /notice %}} -ThreadGuard checks that a driver is called only from the same thread that created it. -Threading issues especially when running tests in Parallel may have mysterious -and hard to diagnose errors. Using this wrapper prevents this category of errors -and will raise an exception when it happens. +ThreadGuard comprueba que se llama a un controlador solo desde el +mismo hilo que lo creó. Los problemas de subprocesos, especialmente +cuando se ejecutan pruebas en paralelo, pueden tener errores misteriosos y +difícil de diagnosticar. El uso de este contenedor evita esta +categoría de errores y generará una excepción cuando ocurran. -The following example simulate a clash of threads: +El siguiente ejemplo simula un choque de hilos: ```java public class DriverClash { - //thread main (id 1) created this driver + //El hilo (thread) main (id 1) creó este controlador private WebDriver protectedDriver = ThreadGuard.protect(new ChromeDriver()); static { System.setProperty("webdriver.chrome.driver", ""); } - //Thread-1 (id 24) is calling the same driver causing the clash to happen + //Thread-1 (id 24) llama al mismo controlador causando el choque Runnable r1 = () -> {protectedDriver.get("https://selenium.dev");}; Thread thr1 = new Thread(r1); @@ -57,7 +53,7 @@ public class DriverClash { } ``` -The result shown below: +El resultado se muestra a continuación: ```text Exception in thread "Thread-1" org.openqa.selenium.WebDriverException: Thread safety error; this instance of WebDriver was constructed @@ -65,14 +61,14 @@ on thread main (id 1)and is being accessed by thread Thread-1 (id 24) This is not permitted and *will* cause undefined behaviour ``` -As seen in the example: +Como puede verse en el ejemplo: - * `protectedDriver` Will be created in Main thread - * We use Java `Runnable` to spin up a new process and a new `Thread` to run the process - * Both `Thread` will clash because the Main Thread does not have `protectedDriver` in it's memory. - * `ThreadGuard.protect` will throw an exception. + * `protectedDriver` Será creado en el hilo Main. + * Utilizamos Java `Runnable` para iniciar un nuevo proceso y un nuevo `Thread` para ejecutar el proceso. + * Ambos `Thread` chocarán porque el Thread principal no tiene `protectedDriver` en su memoria. + * `ThreadGuard.protect` lanzará una excepción. -#### Note: +#### Nota: -This does not replace the need for using `ThreadLocal` to manage drivers when running parallel. +Esto no reemplaza la necesidad de usar `ThreadLocal` para administrar los controladores cuando se ejecutan en paralelo. diff --git a/docs_source_files/content/webdriver/web_element.es.md b/docs_source_files/content/webdriver/web_element.es.md index d58b9f5227e5..b7cb9c9d3c81 100644 --- a/docs_source_files/content/webdriver/web_element.es.md +++ b/docs_source_files/content/webdriver/web_element.es.md @@ -3,23 +3,19 @@ title: "Elemento web" weight: 9 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +WebElement representa un elemento del DOM. Los WebElements se pueden +encontrar buscando desde la raíz del documento utilizando una instancia de +WebDriver o buscando en otra WebElement. -WebElement represents a DOM element. WebElements can be found by searching from the -document root using a WebDriver instance, or by searching under another -WebElement. - -WebDriver API provides built-in methods to find the WebElements which are -based on different properties like ID, Name, Class, XPath, CSS Selectors, link Text, etc. +El API WebDriver proporciona métodos integrados para encontrar los +elementos web que son basados en diferentes propiedades como ID, +Nombre, Clase, XPath, Selectores CSS, Texto de enlace, etc. ## Find Element -It is used to find an element and returns a first matching single WebElement reference, -that can be used for future element actions +Se utiliza para encontrar un elemento y devuelve la primera +referencia única de WebElement que coincide, que puede usarse para +acciones futuras con el elemento {{< code-tab >}} {{< code-panel language="java" >}} @@ -27,7 +23,7 @@ WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com"); -// Get search box element from webElement 'q' using Find Element +// Obtén el elemento cuadro de búsqueda del webElement 'q' utilizando Find Element WebElement searchBox = driver.findElement(By.name("q")); searchBox.sendKeys("webdriver"); @@ -37,7 +33,7 @@ driver = Firefox() driver.get("http://www.google.com") -# Get search box element from webElement 'q' using Find Element +# Obtén el elemento cuadro de búsqueda del webElement 'q' utilizando Find Element search_box = driver.find_element_by_name("q") search_box.send_keys("webdriver") @@ -47,7 +43,7 @@ IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; -// Get search box element from webElement 'q' using Find Element +// Obtén el elemento cuadro de búsqueda del webElement 'q' utilizando Find Element IWebElement searchbox = driver.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); @@ -56,13 +52,13 @@ searchbox.SendKeys("webdriver"); require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox begin - # Navigate to URL + # Navega a la URL driver.get 'https://google.com' - # Get search box element from webElement 'q' using Find Element + # Obtén el elemento cuadro de búsqueda del webElement 'q' utilizando Find Element search_bar = driver.find_element(name: 'q') - # Perform action using WebElement + # Ejecuta una acción utilizando WebElement search_bar.send_keys 'Webdriver' ensure driver.quit @@ -74,13 +70,13 @@ driver = new Builder().forBrowser('firefox').build(); (async function test(){ -//Navigate to url +// Navega a la URL await driver.get('http://www.google.com'); -// Get search box element from webElement 'q' using Find Element +// Obtén el elemento cuadro de búsqueda del webElement 'q' utilizando Find Element let searchBar = driver.findElement(By.name('q')); -//Perform action using WebElement +// Ejecuta una acción utilizando WebElemen await searchBar.sendKeys('Webdriver'); })(); @@ -90,7 +86,7 @@ val driver = FirefoxDriver() driver.get("http://www.google.com") -// Get search box element from webElement 'q' using Find Element +// Obtén el elemento cuadro de búsqueda del webElement 'q' utilizando Find Element val searchBox = driver.findElement(By.name("q")) searchBox.sendKeys("webdriver") @@ -99,8 +95,11 @@ searchBox.sendKeys("webdriver") ## Find Elements -Similar to 'Find Element', but returns a list of matching WebElements. To use a particular WebElement from the list, -you need to loop over the list of elements to perform action on selected element. +Similar a 'Find Element', pero devuelve una lista +de elementos web coincidentes. +Para usar un WebElement particular de la lista, +debes recorrerla lista de elementos para realizar +acciones con el elemento seleccionado. {{< code-tab >}} {{< code-panel language="java" >}} @@ -115,7 +114,7 @@ public class findElementsExample { WebDriver driver = new FirefoxDriver(); try { driver.get("https://example.com"); - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' List elements = driver.findElements(By.tagName("p")); for (WebElement element : elements) { System.out.println("Paragraph text:" + element.getText()); @@ -131,10 +130,10 @@ from selenium import webdriver driver = webdriver.Firefox() -# Navigate to Url +# Navega a la Url driver.get("https://www.example.com") -# Get all the elements available with tag name 'p' +# Obtén todos los elementos con el nombre de etiqueta 'p' elements = driver.find_elements_by_tag_name('p') for e in elements: @@ -150,10 +149,10 @@ namespace FindElementsExample { public static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); try { - // Navigate to Url + // Navega a la Url driver.Navigate().GoToUrl("https://example.com"); - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' IList < IWebElement > elements = driver.FindElements(By.TagName("p")); foreach(IWebElement e in elements) { System.Console.WriteLine(e.Text); @@ -170,10 +169,10 @@ namespace FindElementsExample { require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox begin - # Navigate to URL + # Navega a la Url driver.get 'https://www.example.com' - # Get all the elements available with tag name 'p' + # Obtén todos los elementos con el nombre de etiqueta 'p' elements = driver.find_elements(:tag_name,'p') elements.each { |e| @@ -188,10 +187,10 @@ const {Builder, By} = require('selenium-webdriver'); (async function example() { let driver = await new Builder().forBrowser('firefox').build(); try { - // Navigate to Url + // Navega a la URL await driver.get('https://www.example.com'); - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' let elements = await driver.findElements(By.tagName('p')); for(let e of elements) { console.log(await e.getText()); @@ -210,7 +209,7 @@ fun main() { val driver = FirefoxDriver() try { driver.get("https://example.com") - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' val elements = driver.findElements(By.tagName("p")) for (element in elements) { println("Paragraph text:" + element.text) @@ -222,10 +221,12 @@ fun main() { {{< / code-panel >}} {{< / code-tab >}} -## Find Element From Element +## Find Element desde Element -It is used to find a child element within the context of parent element. -To achieve this, the parent WebElement is chained with 'findElement' to access child elements +Se utiliza para encontrar un elemento hijo dentro +del contexto del elemento padre. +Para lograr esto, el WebElement primario se encadena +con 'findElement' para acceder a elementos secundarios. {{< code-tab >}} {{< code-panel language="java" >}} @@ -253,16 +254,16 @@ searchbox.SendKeys("webdriver"); require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox begin - # Navigate to URL + # Navega a la URL driver.get 'https://google.com' - # Get and store DOM element '
    ' + # Obtén y almacena el elemento DOM `` search_form = driver.find_element(name: 'f') - # Get search box element from webElement 'form' + # Obtén el elemento de caja de búsqueda del elemento `form` search_bar = search_form.find_element(name: 'q') - # Perform action using WebElement + # Ejecuta una acción usando WebElement search_bar.send_keys 'Webdriver' ensure driver.quit @@ -274,16 +275,16 @@ driver = new Builder().forBrowser('firefox').build(); (async function test(){ -//Navigate to url +//Navega a la URL await driver.get('http://www.google.com'); -//Get and store DOM element '' +//Obtén y alamacena el elemento DOM `` let searchForm = driver.findElement(By.name('f')); -//Get search box element from webElement 'form' +//Obtén el elemento de caja de búsqueda del elemento `form` let searchBar = searchForm.findElement(By.name('q')); -//Perform action using WebElement +//Ejecuta una acción usando WebElement await searchBar.sendKeys('Webdriver'); })(); @@ -297,10 +298,12 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} -## Find Elements From Element +## Find Elements desde Element -It is used to find the list of matching child WebElements within the context of parent element. -To achieve this, the parent WebElement is chained with 'findElements' to access child elements +Se utiliza para encontrar una lista de elementos +hijos dentro del contexto del elemento padre. +Para lograr esto, el WebElement primario se encadena +con 'findElements'para acceder a elementos secundarios. {{< code-tab >}} {{< code-panel language="java" >}} @@ -316,10 +319,10 @@ To achieve this, the parent WebElement is chained with 'findElements' to access try { driver.get("https://example.com"); - // Get element with tag name 'div' + // Obten el elemento con el nombre de etiqueta 'div' WebElement element = driver.findElement(By.tagName("div")); - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' List elements = element.findElements(By.tagName("p")); for (WebElement e : elements) { System.out.println(e.getText()); @@ -336,10 +339,10 @@ To achieve this, the parent WebElement is chained with 'findElements' to access driver = webdriver.Chrome() driver.get("https://www.example.com") - # Get element with tag name 'div' + # Obten el elemento con el nombre de etiqueta 'div' element = driver.find_element_by_tag_name('div') - # Get all the elements available with tag name 'p' + # Obtén todos los elementos con el nombre de etiqueta 'p' elements = element.find_elements_by_tag_name('p') for e in elements: print e.text @@ -356,10 +359,10 @@ namespace FindElementsFromElement { try { driver.Navigate().GoToUrl("https://example.com"); - // Get element with tag name 'div' + // Obten el elemento con el nombre de etiqueta 'div' IWebElement element = driver.FindElement(By.TagName("div")); - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' IList < IWebElement > elements = element.FindElements(By.TagName("p")); foreach(IWebElement e in elements) { System.Console.WriteLine(e.Text); @@ -375,13 +378,13 @@ namespace FindElementsFromElement { require 'selenium-webdriver' driver = Selenium::WebDriver.for :chrome begin - # Navigate to URL + # Navega a la URL driver.get 'https://www.example.com' - # Get element with tag name 'div' + # Obten el elemento con el nombre de etiqueta 'div' element = driver.find_element(:tag_name,'div') - # Get all the elements available with tag name 'p' + # Obtén todos los elementos con el nombre de etiqueta 'p' elements = element.find_elements(:tag_name,'p') elements.each { |e| @@ -401,10 +404,10 @@ namespace FindElementsFromElement { await driver.get('https://www.example.com'); - // Get element with tag name 'div' + // Obten el elemento con el nombre de etiqueta 'div' let element = driver.findElement(By.tagName("div")); - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' let elements = await element.findElements(By.tagName("p")); for(let e of elements) { console.log(await e.getText()); @@ -420,10 +423,10 @@ namespace FindElementsFromElement { try { driver.get("https://example.com") - // Get element with tag name 'div' + // Obten el elemento con el nombre de etiqueta 'div' val element = driver.findElement(By.tagName("div")) - // Get all the elements available with tag name 'p' + // Obtén todos los elementos con el nombre de etiqueta 'p' val elements = element.findElements(By.tagName("p")) for (e in elements) { println(e.text) @@ -435,9 +438,10 @@ namespace FindElementsFromElement { {{< / code-panel >}} {{< / code-tab >}} -## Get Active Element +## Active Element -It is used to track (or) find DOM element which has the focus in the current browsing context. +Se utiliza para rastrear (o) encontrar el elemento DOM +que tiene el foco en el contexto de navegación actual. {{< code-tab >}} {{< code-panel language="java" >}} @@ -451,7 +455,7 @@ It is used to track (or) find DOM element which has the focus in the current bro driver.get("http://www.google.com"); driver.findElement(By.cssSelector("[name='q']")).sendKeys("webElement"); - // Get attribute of current active element + // Obtener el atributo del elemento activo actual String attr = driver.switchTo().activeElement().getAttribute("title"); System.out.println(attr); } finally { @@ -467,7 +471,7 @@ It is used to track (or) find DOM element which has the focus in the current bro driver.get("https://www.google.com") driver.find_element_by_css_selector('[name="q"]').send_keys("webElement") - # Get attribute of current active element + # Obtener el atributo del elemento activo actual attr = driver.switch_to.active_element.get_attribute("title") print attr {{< / code-panel >}} @@ -480,11 +484,11 @@ It is used to track (or) find DOM element which has the focus in the current bro public static void Main(string[] args) { IWebDriver driver = new ChromeDriver(); try { - // Navigate to Url + // Navega a la URL driver.Navigate().GoToUrl("https://www.google.com"); driver.FindElement(By.CssSelector("[name='q']")).SendKeys("webElement"); - // Get attribute of current active element + // Obtener el atributo del elemento activo actual string attr = driver.SwitchTo().ActiveElement().GetAttribute("title"); System.Console.WriteLine(attr); } finally { @@ -501,7 +505,7 @@ It is used to track (or) find DOM element which has the focus in the current bro driver.get 'https://www.google.com' driver.find_element(css: '[name="q"]').send_keys('webElement') - # Get attribute of current active element + # Obtener el atributo del elemento activo actual attr = driver.switch_to.active_element.attribute('title') puts attr ensure @@ -516,7 +520,7 @@ It is used to track (or) find DOM element which has the focus in the current bro await driver.get('https://www.google.com'); await driver.findElement(By.css('[name="q"]')).sendKeys("webElement"); - // Get attribute of current active element + // Obtener el atributo del elemento activo actual let attr = await driver.switchTo().activeElement().getAttribute("title"); console.log(`${attr}`) })(); @@ -531,7 +535,7 @@ It is used to track (or) find DOM element which has the focus in the current bro driver.get("https://www.google.com") driver.findElement(By.cssSelector("[name='q']")).sendKeys("webElement") - // Get attribute of current active element + // Obtener el atributo del elemento activo actual val attr = driver.switchTo().activeElement().getAttribute("title"); print(attr); } finally {