From 41e5d3e262d8b2cf8f86c41547ab93c8596a78c3 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Mon, 16 Dec 2019 20:24:33 +0530 Subject: [PATCH 01/10] Modify: Removed unneccessary awaits for find element Signed-off-by: Sri Harsha --- .../locating_elements.de.md | 10 +++++----- .../locating_elements.en.md | 10 +++++----- .../locating_elements.es.md | 10 +++++----- .../locating_elements.fr.md | 10 +++++----- .../locating_elements.ja.md | 10 +++++----- .../locating_elements.ko.md | 10 +++++----- .../locating_elements.nl.md | 10 +++++----- .../locating_elements.zh-cn.md | 10 +++++----- .../performing_actions_on_the_aut.de.md | 8 ++++---- .../performing_actions_on_the_aut.en.md | 4 ++-- .../performing_actions_on_the_aut.es.md | 4 ++-- .../performing_actions_on_the_aut.fr.md | 4 ++-- .../performing_actions_on_the_aut.ja.md | 4 ++-- .../performing_actions_on_the_aut.ko.md | 4 ++-- .../performing_actions_on_the_aut.nl.md | 4 ++-- .../performing_actions_on_the_aut.zh-cn.md | 4 ++-- .../content/webdriver/browser_manipulation.de.md | 2 +- .../content/webdriver/browser_manipulation.en.md | 2 +- .../content/webdriver/browser_manipulation.es.md | 2 +- .../content/webdriver/browser_manipulation.fr.md | 2 +- .../content/webdriver/browser_manipulation.ja.md | 2 +- .../content/webdriver/browser_manipulation.ko.md | 2 +- .../content/webdriver/browser_manipulation.nl.md | 2 +- .../content/webdriver/browser_manipulation.zh-cn.md | 2 +- 24 files changed, 66 insertions(+), 66 deletions(-) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.de.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.de.md index 057d6da0a15b..2e7b4a80dfa5 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.de.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.de.md @@ -29,7 +29,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -66,8 +66,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -112,7 +112,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -155,7 +155,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.en.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.en.md index 4b5a9346af12..adf190c3f66b 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.en.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.en.md @@ -23,7 +23,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -60,8 +60,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -106,7 +106,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -149,7 +149,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) 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 897c56da5952..ab47023b9cf6 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 @@ -22,7 +22,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -54,8 +54,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -84,7 +84,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -120,7 +120,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.fr.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.fr.md index 347016947163..87d446665d53 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.fr.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.fr.md @@ -30,7 +30,7 @@ IWebElement element = driver.FindElement(By.Id("fromage")); driver.find_element(id: "fromage") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const fromage = await driver.findElement(By.id('fromage')); +const fromage = driver.findElement(By.id('fromage')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -67,8 +67,8 @@ fromage = driver.find_element(id: "fromage") cheddar = fromage.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const fromage = await driver.findElement(By.id('fromage')); -const cheddar = await fromage.findElement(By.id('cheddar')); +const fromage = driver.findElement(By.id('fromage')); +const cheddar = fromage.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -111,7 +111,7 @@ driver.FindElement(By.CssSelector("#fromage #cheddar")); mucho_cheese = driver.find_elements(css: "#fromage #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#fromage #cheddar')); +const cheddar = driver.findElement(By.css('#fromage #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -153,7 +153,7 @@ IReadOnlyList pleinDeFromage = driver.FindElements(By.CssSelector( plein_de_fromage = driver.find_elements(css: "#fromage li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const pleinDeFromage = await driver.findElements(By.css('#fromage li')); +const pleinDeFromage = driver.findElements(By.css('#fromage li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.ja.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.ja.md index 7239fd9608f6..4b7c7ac2d18b 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.ja.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.ja.md @@ -28,7 +28,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -65,8 +65,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -111,7 +111,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -154,7 +154,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.ko.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.ko.md index 90f0f2d6b7bd..432416c78dab 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.ko.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.ko.md @@ -29,7 +29,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -66,8 +66,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -112,7 +112,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -155,7 +155,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.nl.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.nl.md index cff4ddbb6ac4..ad2ea83b36c4 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.nl.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.nl.md @@ -31,7 +31,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -67,8 +67,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -115,7 +115,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -158,7 +158,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/locating_elements.zh-cn.md b/docs_source_files/content/getting_started_with_webdriver/locating_elements.zh-cn.md index 735f6dd73c00..622b389b86ea 100644 --- a/docs_source_files/content/getting_started_with_webdriver/locating_elements.zh-cn.md +++ b/docs_source_files/content/getting_started_with_webdriver/locating_elements.zh-cn.md @@ -28,7 +28,7 @@ IWebElement element = driver.FindElement(By.Id("cheese")); driver.find_element(id: "cheese") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); +const cheese = driver.findElement(By.id('cheese')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese: WebElement = driver.findElement(By.id("cheese")) @@ -65,8 +65,8 @@ cheese = driver.find_element(id: "cheese") cheddar = cheese.find_elements(id: "cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheese = await driver.findElement(By.id('cheese')); -const cheddar = await cheese.findElement(By.id('cheddar')); +const cheese = driver.findElement(By.id('cheese')); +const cheddar = cheese.findElement(By.id('cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val cheese = driver.findElement(By.id("cheese")) @@ -111,7 +111,7 @@ driver.FindElement(By.CssSelector("#cheese #cheddar")); mucho_cheese = driver.find_elements(css: "#cheese #cheddar") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const cheddar = await driver.findElement(By.css('#cheese #cheddar')); +const cheddar = driver.findElement(By.css('#cheese #cheddar')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} driver.findElement(By.cssSelector("#cheese #cheddar")) @@ -154,7 +154,7 @@ IReadOnlyList muchoCheese = driver.FindElements(By.CssSelector(“# mucho_cheese = driver.find_elements(css: "#cheese li") {{< / code-panel >}} {{< code-panel language="javascript" >}} -const muchoCheese = await driver.findElements(By.css('#cheese li')); +const muchoCheese = driver.findElements(By.css('#cheese li')); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val muchoCheese: List = driver.findElements(By.cssSelector("#cheese li")) diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.de.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.de.md index 7520e2af36c0..8fdd6becf4bd 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.de.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.de.md @@ -25,11 +25,11 @@ driver.FindElement(By.Name("name")).SendKeys(name); {{< / code-panel >}} {{< code-panel language="ruby" >}} name = "Charles" -driver.find_element(name: "name").send_keys(name) +await driver.find_element(name: "name").send_keys(name) {{< / code-panel >}} {{< code-panel language="javascript" >}} const name = "Charles"; -await driver.findElement(By.name('name')).sendKeys(name); +driver.findElement(By.name('name')).sendKeys(name); {{< / code-panel >}} {{< code-panel language="kotlin" >}} val name = "Charles" @@ -64,8 +64,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.en.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.en.md index c3b6baf214d8..8a033197cf6c 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.en.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.en.md @@ -59,8 +59,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.es.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.es.md index ae1db0f13366..8c85856729f9 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.es.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.es.md @@ -58,8 +58,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.fr.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.fr.md index 5d008372eca7..422d8d99441d 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.fr.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.fr.md @@ -59,8 +59,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ja.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ja.md index 09b65f07c26b..318f6429c1bf 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ja.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ja.md @@ -64,8 +64,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ko.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ko.md index d520633de6b3..1379928d1838 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ko.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.ko.md @@ -65,8 +65,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.nl.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.nl.md index c7c31fb34a11..3dfbb4bcd21f 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.nl.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.nl.md @@ -59,8 +59,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.zh-cn.md b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.zh-cn.md index a5b6e4e313b8..fe3fd96946f1 100644 --- a/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.zh-cn.md +++ b/docs_source_files/content/getting_started_with_webdriver/performing_actions_on_the_aut.zh-cn.md @@ -58,8 +58,8 @@ driver.action.drag_and_drop(source, target).perform {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions({bridge: true}); -const source = await driver.findElement(By.id('source')); -const target = await driver.findElement(By.id('target')); +const source = driver.findElement(By.id('source')); +const target = driver.findElement(By.id('target')); await actions.dragAndDrop(source, target).perform(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} diff --git a/docs_source_files/content/webdriver/browser_manipulation.de.md b/docs_source_files/content/webdriver/browser_manipulation.de.md index f5d023a68940..88bef8572a00 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.de.md +++ b/docs_source_files/content/webdriver/browser_manipulation.de.md @@ -721,7 +721,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.en.md b/docs_source_files/content/webdriver/browser_manipulation.en.md index 325f517a997d..7025273fe2e8 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.en.md +++ b/docs_source_files/content/webdriver/browser_manipulation.en.md @@ -714,7 +714,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.es.md b/docs_source_files/content/webdriver/browser_manipulation.es.md index dbc4ab3cb220..4b6c2131b28a 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.es.md +++ b/docs_source_files/content/webdriver/browser_manipulation.es.md @@ -720,7 +720,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.fr.md b/docs_source_files/content/webdriver/browser_manipulation.fr.md index 4de898580f2c..da356fa5c09a 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.fr.md +++ b/docs_source_files/content/webdriver/browser_manipulation.fr.md @@ -717,7 +717,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.ja.md b/docs_source_files/content/webdriver/browser_manipulation.ja.md index c61431989855..bf11c0271ace 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.ja.md +++ b/docs_source_files/content/webdriver/browser_manipulation.ja.md @@ -718,7 +718,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.ko.md b/docs_source_files/content/webdriver/browser_manipulation.ko.md index 9b154530fa9c..103b9eee9a8c 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.ko.md +++ b/docs_source_files/content/webdriver/browser_manipulation.ko.md @@ -720,7 +720,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.nl.md b/docs_source_files/content/webdriver/browser_manipulation.nl.md index 147a8656dadc..8d3bcac72442 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.nl.md +++ b/docs_source_files/content/webdriver/browser_manipulation.nl.md @@ -717,7 +717,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); diff --git a/docs_source_files/content/webdriver/browser_manipulation.zh-cn.md b/docs_source_files/content/webdriver/browser_manipulation.zh-cn.md index 574c36634f08..a8f20054ea1e 100644 --- a/docs_source_files/content/webdriver/browser_manipulation.zh-cn.md +++ b/docs_source_files/content/webdriver/browser_manipulation.zh-cn.md @@ -716,7 +716,7 @@ driver.find_element(:tag_name,'button').click {{< / code-panel >}} {{< code-panel language="javascript" >}} // Store the web element -const iframe = await driver.findElement(By.css('#modal > iframe')); +const iframe = driver.findElement(By.css('#modal > iframe')); // Switch to the frame await driver.switchTo().frame(iframe); From 5051195c78bde0ceddc6e1c57cd201a8af3d5cf9 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Tue, 17 Dec 2019 13:43:54 +0530 Subject: [PATCH 02/10] Add: Added ruby sample code for mouse actionsin support package Signed-off-by: Sri Harsha --- .../mouse_and_keyboard_actions_in_detail.de.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.en.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.es.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.fr.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.ja.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.ko.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.nl.md | 6 ++++-- .../mouse_and_keyboard_actions_in_detail.zh-cn.md | 6 ++++-- 8 files changed, 32 insertions(+), 16 deletions(-) diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md index dca0d0c6e995..77a5045e164a 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md @@ -69,7 +69,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -98,7 +98,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md index 3024c3c4b279..a070f9887d58 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md @@ -64,7 +64,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -93,7 +93,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md index b0494dc5eacd..815a3cf9c404 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md @@ -71,7 +71,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -100,7 +100,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md index 63fe32e31abf..7057bef914e6 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md @@ -70,7 +70,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -99,7 +99,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md index 4b2fc9114471..5f6e1960ba1b 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md @@ -69,7 +69,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -98,7 +98,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md index 0a2851646905..b4887e017531 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md @@ -70,7 +70,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -99,7 +99,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md index 1cb2c833126e..0becf38865f8 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md @@ -70,7 +70,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -99,7 +99,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md index 56b8ecdf037a..1c9d277582f5 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md @@ -69,7 +69,7 @@ from selenium.webdriver import ActionChains using OpenQA.Selenium.Interactions; {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action = driver.action {{< / code-panel >}} {{< code-panel language="javascript" >}} const actions = driver.actions(); @@ -98,7 +98,9 @@ actions.perform() actions.Perform(); {{< / code-panel >}} {{< code-panel language="ruby" >}} -# We don't have a Ruby code sample yet - Help us out and raise a PR +action +.move_to(e) +.perform {{< / code-panel >}} {{< code-panel language="javascript" >}} await actions From 4123fa2856bfacc797ccdf247ce2a01c0c553221 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Tue, 24 Dec 2019 16:51:17 +0530 Subject: [PATCH 03/10] Modify: Revamping the WebElement usage document Signed-off-by: Sri Harsha --- .../content/webdriver/web_element.de.md | 93 ++++++++++++++++- .../content/webdriver/web_element.en.md | 95 +++++++++++++++++- .../content/webdriver/web_element.es.md | 99 +++++++++++++++++-- .../content/webdriver/web_element.fr.md | 99 +++++++++++++++++-- .../content/webdriver/web_element.ja.md | 97 +++++++++++++++++- .../content/webdriver/web_element.ko.md | 95 +++++++++++++++++- .../content/webdriver/web_element.nl.md | 97 +++++++++++++++++- .../content/webdriver/web_element.zh-cn.md | 99 ++++++++++++++++++- 8 files changed, 741 insertions(+), 33 deletions(-) diff --git a/docs_source_files/content/webdriver/web_element.de.md b/docs_source_files/content/webdriver/web_element.de.md index 31af88ebc69a..7fbfacd37660 100644 --- a/docs_source_files/content/webdriver/web_element.de.md +++ b/docs_source_files/content/webdriver/web_element.de.md @@ -11,7 +11,96 @@ zu übersetzen indem Du uns einen Pull Reqeust schickst! 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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -32,7 +121,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} diff --git a/docs_source_files/content/webdriver/web_element.en.md b/docs_source_files/content/webdriver/web_element.en.md index 3f573cbb242e..e35b713cabb7 100644 --- a/docs_source_files/content/webdriver/web_element.en.md +++ b/docs_source_files/content/webdriver/web_element.en.md @@ -5,7 +5,96 @@ weight: 9 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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -26,7 +115,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -75,4 +164,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/web_element.es.md b/docs_source_files/content/webdriver/web_element.es.md index 0e032ba8ac28..148e018f7008 100644 --- a/docs_source_files/content/webdriver/web_element.es.md +++ b/docs_source_files/content/webdriver/web_element.es.md @@ -9,9 +9,98 @@ English to Spanish. Do you speak Spanish? Help us to translate it by sending us pull requests! {{% /notice %}} -Represents a DOM element. WebElements can be found by searching from the +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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -32,7 +121,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -81,6 +170,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} - - +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/web_element.fr.md b/docs_source_files/content/webdriver/web_element.fr.md index ac712b3c3130..da8b03b7a2e2 100644 --- a/docs_source_files/content/webdriver/web_element.fr.md +++ b/docs_source_files/content/webdriver/web_element.fr.md @@ -9,9 +9,98 @@ English to French. Do you speak French? Help us to translate it by sending us pull requests! {{% /notice %}} -Represents a DOM element. WebElements can be found by searching from the +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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -32,7 +121,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -81,6 +170,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} - - +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/web_element.ja.md b/docs_source_files/content/webdriver/web_element.ja.md index 68b63e78b02e..e422dec9c36d 100644 --- a/docs_source_files/content/webdriver/web_element.ja.md +++ b/docs_source_files/content/webdriver/web_element.ja.md @@ -8,9 +8,98 @@ weight: 9 日本語は話せますか?プルリクエストをして翻訳を手伝ってください! {{% /notice %}} -Represents a DOM element. WebElements can be found by searching from the +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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -31,7 +120,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -80,4 +169,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/web_element.ko.md b/docs_source_files/content/webdriver/web_element.ko.md index 495bd6748500..c13858e3a919 100644 --- a/docs_source_files/content/webdriver/web_element.ko.md +++ b/docs_source_files/content/webdriver/web_element.ko.md @@ -11,7 +11,96 @@ it by sending us pull requests! 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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -32,7 +121,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -81,4 +170,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/web_element.nl.md b/docs_source_files/content/webdriver/web_element.nl.md index 7ea55c1b524b..42bc34822ce8 100644 --- a/docs_source_files/content/webdriver/web_element.nl.md +++ b/docs_source_files/content/webdriver/web_element.nl.md @@ -9,9 +9,98 @@ English to Dutch. Do you speak Dutch? Help us to translate it by sending us pull requests! {{% /notice %}} -Represents a DOM element. WebElements can be found by searching from the +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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = driver.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -32,7 +121,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -81,4 +170,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/web_element.zh-cn.md b/docs_source_files/content/webdriver/web_element.zh-cn.md index 6f2e9a1de8db..f0891361a31f 100644 --- a/docs_source_files/content/webdriver/web_element.zh-cn.md +++ b/docs_source_files/content/webdriver/web_element.zh-cn.md @@ -8,9 +8,98 @@ weight: 9 您熟悉英语与简体中文吗?帮助我们翻译它,通过 pull requests 给我们! {{% /notice %}} -Represents a DOM element. WebElements can be found by searching from the +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: +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. + +## Find Element + +It is used to find an element and returns a single WebElement reference, +that can be used for future element actions + +{{< code-tab >}} + {{< code-panel language="java" >}} +WebDriver driver = new FirefoxDriver(); + +driver.get("http://www.google.com"); + +// Get search box element from webElement 'q' using Find Element +WebElement searchBox = driver.findElement(By.name("q")); + +searchBox.sendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="python" >}} +driver = Firefox() + +driver.get("http://www.google.com") + +# Get search box element from webElement 'q' using Find Element +search_box = driver.find_element_by_name("q") + +search_box.send_keys("webdriver") + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +IWebDriver driver = new FirefoxDriver(); + +driver.Url = "http://www.google.com"; + +// Get search box element from webElement 'q' using Find Element +IWebElement searchbox = driver.FindElement(By.Name("q")); + +searchbox.SendKeys("webdriver"); + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://google.com' + + # Get search box element from webElement 'q' using Find Element + search_bar = driver.find_element(name: 'q') + + # Perform action using WebElement + search_bar.send_keys 'Webdriver' +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +let {Builder, By} = require('selenium-webdriver'); +driver = new Builder().forBrowser('chrome').build(); + +(async function test(){ + +//Navigate to url +await driver.get('http://www.google.com'); + +// Get search box element from webElement 'q' using Find Element +let searchBar = searchForm.findElement(By.name('q')); + +//Perform action using WebElement +await searchBar.sendKeys('Webdriver'); + +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +val driver = ChromeDriver() + +driver.get("http://www.google.com") + +// Get search box element from webElement 'q' using Find Element +val searchBox = driver.findElement(By.name("q")) + +searchBox.sendKeys("webdriver") + {{< / code-panel >}} +{{< / code-tab >}} + +## Find Element From 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 {{< code-tab >}} {{< code-panel language="java" >}} @@ -31,7 +120,7 @@ search_box.send_keys("webdriver") IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; IWebElement searchForm = driver.FindElement(By.TagName("form")); -IWebElement searchbox = driver.FindElement(By.Name("q")); +IWebElement searchbox = searchForm.FindElement(By.Name("q")); searchbox.SendKeys("webdriver"); {{< / code-panel >}} {{< code-panel language="ruby" >}} @@ -66,7 +155,7 @@ await driver.get('http://www.google.com'); let searchForm = driver.findElement(By.name('f')); //Get search box element from webElement 'form' -let searchBar = searchForm.findElement(By.name('q')); +let searchBar = driver.findElement(By.name('q')); //Perform action using WebElement await searchBar.sendKeys('Webdriver'); @@ -80,4 +169,4 @@ val searchForm = driver.findElement(By.tagName("form")) val searchBox = searchForm.findElement(By.name("q")) searchBox.sendKeys("webdriver") {{< / code-panel >}} -{{< / code-tab >}} +{{< / code-tab >}} \ No newline at end of file From 381083d887776863d8f4879d671866bc4d961c53 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Tue, 24 Dec 2019 20:39:36 +0530 Subject: [PATCH 04/10] Add: Adding findElements section to web_element document Signed-off-by: Sri Harsha --- .../content/webdriver/web_element.de.md | 104 +++++++++++++++++- .../content/webdriver/web_element.en.md | 104 +++++++++++++++++- .../content/webdriver/web_element.es.md | 104 +++++++++++++++++- .../content/webdriver/web_element.fr.md | 104 +++++++++++++++++- .../content/webdriver/web_element.ja.md | 104 +++++++++++++++++- .../content/webdriver/web_element.ko.md | 104 +++++++++++++++++- .../content/webdriver/web_element.nl.md | 104 +++++++++++++++++- .../content/webdriver/web_element.zh-cn.md | 104 +++++++++++++++++- 8 files changed, 824 insertions(+), 8 deletions(-) diff --git a/docs_source_files/content/webdriver/web_element.de.md b/docs_source_files/content/webdriver/web_element.de.md index 7fbfacd37660..9fd61fe26fde 100644 --- a/docs_source_files/content/webdriver/web_element.de.md +++ b/docs_source_files/content/webdriver/web_element.de.md @@ -18,7 +18,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -97,6 +97,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.en.md b/docs_source_files/content/webdriver/web_element.en.md index e35b713cabb7..af12c9e704e2 100644 --- a/docs_source_files/content/webdriver/web_element.en.md +++ b/docs_source_files/content/webdriver/web_element.en.md @@ -12,7 +12,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -91,6 +91,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.es.md b/docs_source_files/content/webdriver/web_element.es.md index 148e018f7008..5a54746fde2e 100644 --- a/docs_source_files/content/webdriver/web_element.es.md +++ b/docs_source_files/content/webdriver/web_element.es.md @@ -18,7 +18,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -97,6 +97,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.fr.md b/docs_source_files/content/webdriver/web_element.fr.md index da8b03b7a2e2..4b608626b93b 100644 --- a/docs_source_files/content/webdriver/web_element.fr.md +++ b/docs_source_files/content/webdriver/web_element.fr.md @@ -18,7 +18,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -97,6 +97,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.ja.md b/docs_source_files/content/webdriver/web_element.ja.md index e422dec9c36d..0cb81fe31a4c 100644 --- a/docs_source_files/content/webdriver/web_element.ja.md +++ b/docs_source_files/content/webdriver/web_element.ja.md @@ -17,7 +17,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -96,6 +96,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.ko.md b/docs_source_files/content/webdriver/web_element.ko.md index c13858e3a919..cc16e679137a 100644 --- a/docs_source_files/content/webdriver/web_element.ko.md +++ b/docs_source_files/content/webdriver/web_element.ko.md @@ -18,7 +18,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -97,6 +97,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.nl.md b/docs_source_files/content/webdriver/web_element.nl.md index 42bc34822ce8..7fe4d473684f 100644 --- a/docs_source_files/content/webdriver/web_element.nl.md +++ b/docs_source_files/content/webdriver/web_element.nl.md @@ -18,7 +18,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -97,6 +97,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. diff --git a/docs_source_files/content/webdriver/web_element.zh-cn.md b/docs_source_files/content/webdriver/web_element.zh-cn.md index f0891361a31f..4cb582b92ec9 100644 --- a/docs_source_files/content/webdriver/web_element.zh-cn.md +++ b/docs_source_files/content/webdriver/web_element.zh-cn.md @@ -17,7 +17,7 @@ based on different properties like ID, Name, Class, XPath, CSS Selectors, link T ## Find Element -It is used to find an element and returns a single WebElement reference, +It is used to find an element and returns a first matching single WebElement reference, that can be used for future element actions {{< code-tab >}} @@ -96,6 +96,108 @@ searchBox.sendKeys("webdriver") {{< / code-panel >}} {{< / code-tab >}} +## 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. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import java.util.List; + +public class findElementsExample { + public static void main(String[] args) { + WebDriver driver = new FirefoxDriver(); + try { + driver.get("https://example.com"); + // Get all the elements available with tag name 'p' + List elements = driver.findElements(By.tagName("p")); + for (WebElement element : elements) { + System.out.println("Paragraph text:" + element.getText()); + } + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +from selenium import webdriver + +driver = webdriver.Firefox() + +# Navigate to Url +driver.get("https://www.example.com") + +# Get all the elements available with tag name 'p' +elements = driver.find_elements_by_tag_name('p') + +for e in elements: + print e.text + {{< / code-panel >}} + {{< code-panel language="csharp" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :firefox +begin + # Navigate to URL + driver.get 'https://www.example.com' + + # Get all the elements available with tag name 'p' + elements = driver.find_elements(:tag_name,'p') + + elements.each { |e| + puts e.text + } +ensure + driver.quit +end + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, By} = require('selenium-webdriver'); +(async function example() { + let driver = await new Builder().forBrowser('firefox').build(); + try { + // Navigate to Url + await driver.get('https://www.example.com'); + + // Get all the elements available with tag name 'p' + let elements = await driver.findElements(By.tagName('p')); + for(let e of elements) { + console.log(await e.getText()); + } + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +import org.openqa.selenium.By +import org.openqa.selenium.firefox.FirefoxDriver + +fun main() { + val driver = FirefoxDriver() + try { + driver.get("https://example.com") + // Get all the elements available with tag name 'p' + val elements = driver.findElements(By.tagName("p")) + for (element in elements) { + println("Paragraph text:" + element.text) + } + } finally { + driver.quit() + } +} + {{< / code-panel >}} +{{< / code-tab >}} + ## Find Element From Element It is used to find a child element within the context of parent element. From df1dbd828977a73255b157c2a053bc53ea368d97 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Thu, 26 Dec 2019 16:02:08 +0530 Subject: [PATCH 05/10] Modify: Update to stale PR #111 Signed-off-by: Sri Harsha --- .../remote_webdriver/remote_webdriver_client.de.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.en.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.es.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.fr.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.ja.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.ko.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.nl.md | 9 ++++++++- .../remote_webdriver/remote_webdriver_client.zh-cn.md | 9 ++++++++- 8 files changed, 64 insertions(+), 8 deletions(-) diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md index 5368f032054f..c599f3164b00 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md @@ -24,7 +24,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md index ab9c1c7bb3e9..0806492823f0 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md @@ -18,7 +18,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md index 9900caf32646..abbbc99b5455 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md @@ -24,7 +24,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md index e4514c37f100..b45c20b038a7 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md @@ -24,7 +24,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md index f9a3972f023f..da7e5703de91 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md @@ -23,7 +23,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md index 2064af1b304d..3a170dd99eb2 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md @@ -24,7 +24,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md index a068f7fcb6e0..123baad2e65a 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md @@ -24,7 +24,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md index a4d520efc9c1..2a2fc1482ee2 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md @@ -23,7 +23,14 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +driver = webdriver.Remote( + desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, + command_executor='http://www.example.com' +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); From a65dfa072f53bbc8c99930c4ba0ebf8ef9be5816 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Thu, 26 Dec 2019 19:12:00 +0530 Subject: [PATCH 06/10] Modify: Removed desired capabilities and used FirefoxOptions in code sample Signed-off-by: Sri Harsha --- .../remote_webdriver_client.de.md | 19 +++++++++++++++---- .../remote_webdriver_client.en.md | 19 +++++++++++++++---- .../remote_webdriver_client.es.md | 19 +++++++++++++++---- .../remote_webdriver_client.fr.md | 19 +++++++++++++++---- .../remote_webdriver_client.ja.md | 19 +++++++++++++++---- .../remote_webdriver_client.ko.md | 17 ++++++++++++++--- .../remote_webdriver_client.nl.md | 17 ++++++++++++++--- .../remote_webdriver_client.zh-cn.md | 19 +++++++++++++++---- 8 files changed, 118 insertions(+), 30 deletions(-) diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md index c599f3164b00..b2be1e34cabc 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.de.md @@ -26,12 +26,13 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") -driver.quit() +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); @@ -88,7 +89,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md index 0806492823f0..cbc720979b67 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.en.md @@ -20,12 +20,13 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") -driver.quit() +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); @@ -82,7 +83,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md index abbbc99b5455..9dceb4ede227 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.es.md @@ -26,12 +26,13 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") -driver.quit() +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); @@ -88,7 +89,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md index b45c20b038a7..19b256b73c58 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.fr.md @@ -26,12 +26,13 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") -driver.quit() +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); @@ -88,7 +89,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md index da7e5703de91..e4a1411b74f1 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ja.md @@ -25,12 +25,13 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") -driver.quit() +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); @@ -87,7 +88,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md index 3a170dd99eb2..1cc234678b8f 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.ko.md @@ -26,9 +26,10 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") driver.quit() @@ -88,7 +89,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md index 123baad2e65a..cff4fda5c211 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.nl.md @@ -26,9 +26,10 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") driver.quit() @@ -88,7 +89,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); diff --git a/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md b/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md index 2a2fc1482ee2..7319c97bc593 100644 --- a/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md +++ b/docs_source_files/content/remote_webdriver/remote_webdriver_client.zh-cn.md @@ -25,12 +25,13 @@ driver.quit(); {{< code-panel language="python" >}} from selenium import webdriver +firefox_options = webdriver.FirefoxOptions() driver = webdriver.Remote( - desired_capabilities=webdriver.DesiredCapabilities.FIREFOX, - command_executor='http://www.example.com' + command_executor='http://www.example.com', + options=firefox_options ) driver.get("http://www.google.com") -driver.quit() +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} FirefoxOptions firefoxOptions = new FirefoxOptions(); @@ -87,7 +88,17 @@ driver.get("http://www.google.com"); driver.quit(); {{< / code-panel >}} {{< code-panel language="python" >}} -# We don't have a Python code sample yet - Help us out and raise a PR +from selenium import webdriver + +chrome_options = webdriver.ChromeOptions() +chrome_options.set_capability("browserVersion", "67") +chrome_options.set_capability("platformName", "Windows XP") +driver = webdriver.Remote( + command_executor='http://www.example.com', + options=chrome_options +) +driver.get("http://www.google.com") +driver.quit() {{< / code-panel >}} {{< code-panel language="csharp" >}} var chromeOptions = new ChromeOptions(); From 51c4a5519c328f3faeecbe883b286edae852c7c1 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Sat, 25 Jan 2020 22:57:57 +0530 Subject: [PATCH 07/10] Modify: Translated[EN-FR] Introduction-> selenium_proj_and_tools Signed-off-by: Sri Harsha --- .../the_selenium_project_and_tools.fr.md | 230 +++++++++--------- 1 file changed, 112 insertions(+), 118 deletions(-) diff --git a/docs_source_files/content/introduction/the_selenium_project_and_tools.fr.md b/docs_source_files/content/introduction/the_selenium_project_and_tools.fr.md index 5a8e9f865f69..9dba2f0b0f03 100644 --- a/docs_source_files/content/introduction/the_selenium_project_and_tools.fr.md +++ b/docs_source_files/content/introduction/the_selenium_project_and_tools.fr.md @@ -3,121 +3,115 @@ title: "Le projet Selenium et les outils" weight: 1 --- -{{% notice info %}} - Page being translated from -English to French. Do you speak French? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -### Selenium controls web browsers - -_Selenium_ is many things -but at its core, it is a toolset for web browser automation -that uses the best techniques available -to remotely control browser instances -and emulate a user's interaction with the browser. - -It allows users to simulate common activities performed by end-users; -entering text into fields, -selecting drop-down values and checking boxes, -and clicking links in documents. -It also provides many other controls such as mouse movement, -arbitrary JavaScript execution, and much more. - -Although used primarily for front-end testing of websites, -Selenium is at its core a browser user agent _library_. -The interfaces are ubiquitous to their application, -which encourages composition with other libraries to suit your purpose. - - -### One interface to rule them all - -One of the project's guiding principles -is to support a common interface for all (major) browser technologies. -Web browsers are incredibly complex, highly engineered applications, -performing their operations in completely different ways -but which frequently look the same while doing so. -Even though the text is rendered in the same fonts, -the images are displayed in the same place -and the links take you to the same destination. -What is happening underneath is as different as night and day. -Selenium “abstracts” these differences, -hiding their details and intricacies from the person writing the code. -This allows you to write several lines of code to perform a complicated workflow, -but these same lines will execute on Firefox, -Internet Explorer, Chrome, and all other supported browsers. - - -### Tools and support - -Selenium's minimalist design approach gives it the -versatility to be included as a component in bigger applications. -The surrounding infrastructure provided under the Selenium umbrella -gives you the tools to put together -your [grid of browsers]({{< ref "/grid/_index.md" >}}) -so tests can be run on different browsers and multiple operating systems -across a range of machines. - -Imagine a bank of computers in your server room or data center -all firing up browsers at the same time -hitting your site's links, forms, -and tables—testing your application 24 hours a day. -Through the simple programming interface -provided for the most common languages, -these tests will run tirelessly in parallel, -reporting back to you when errors occur. - -It's an aim to help make this a reality for you, -by providing users with tools and documentation to not only control browsers, -but to make it easy to scale and deploy such grids. - - -### Who uses Selenium - -Many of the most important companies in the world -have adopted Selenium for their browser-based testing, -often replacing years-long efforts involving other proprietary tools. -As it has grown in popularity, so have its requirements and challenges multiplied. - -As the web becomes more complicated -and new technologies are added to websites, -it's the mission of this project to keep up with them where possible. -Being an open source project, -this support is provided through the generous donation of time from many volunteers, -every one of which has a “day job”. - -Another mission of the project is to encourage -more volunteers to partake in this effort, -and build a strong community -so that the project can continue to keep up with emerging technologies -and remain a dominant platform for functional test automation. - - -### History - -When Selenium 1 was released in 2004, -it was out of the necessity to reduce time spent -manually verifying consistent behaviour in the front-end of a web application. -It made use of what tools were available at the time -and relied heavily on the injection of JavaScript to the web page under test -to emulate a user's interaction. - -Whilst JavaScript is a good tool to let you introspect the properties of the DOM -and to do certain client-side observations that you would otherwise not be able to do, -it falls short on the ability to naturally replicate a user's interactions -as if the mouse and keyboard are being used. - -Since then, Selenium has grown and matured a lot, -into a tool widely used by many—if not most—of -the largest organisations around the world. -Selenium has gone from a homebrewed test automation toolkit developed at Thoughtworks -for a niché audience and a specific use case, -to the world's _de facto_ browser automation library. - -Just as Selenium RC made use of the tools of the trade available at the time, -[Selenium WebDriver]({{< ref "/webdriver/_index.md" >}}) drives that tradition on by taking -the browser interaction part to the browser vendor's home turf -and asking them to take responsibility of the backend, browser-facing implementations. -Recently this work has evolved into a W3C standardisation process -where the goal is to turn the WebDriver component in Selenium -into the _du jeur_ remote control library for user agents. \ No newline at end of file +### Selenium contrôle les navigateurs Web + +_Selenium_ est beaucoup de choses, mais à la base, +c'est un ensemble d'outils pour l'automatisation du +navigateur Web qui utilise les meilleures techniques +disponibles pour contrôler à distance les instances +du navigateur et émuler l'interaction d'un utilisateur avec le navigateur. + +Il permet aux utilisateurs de simuler les activités +courantes effectuées par les utilisateurs finaux; saisir du +texte dans les champs, sélectionner des valeurs déroulantes et +cocher des cases, et cliquer sur les liens dans les documents. +Il fournit également de nombreux autres contrôles tels que +le mouvement de la souris, l'exécution arbitraire de JavaScript et bien plus encore. + +Bien qu'utilisé principalement pour les tests frontaux des sites Web, +Selenium est à la base une _bibliothèque_ d'agent utilisateur de navigateur. +Les interfaces sont omniprésentes à leur application, +qui encourage la composition avec d'autres bibliothèques en fonction de votre objectif. + +### Une interface pour les gouverner tous + +Un des principes directeurs du projet +est de prendre en charge une interface commune pour toutes les (principales) technologies de navigateur. +Les navigateurs Web sont des applications incroyablement complexes et hautement conçues, +effectuer leurs opérations de manière complètement différente +mais qui se ressemblent souvent en le faisant. +Même si le texte est rendu dans les mêmes polices, +les images sont affichées au même endroit +et les liens vous mènent à la même destination. +Ce qui se passe en dessous est aussi différent que la nuit et le jour. +Le sélénium «résume» ces différences, +cacher leurs détails et leurs subtilités à la personne qui écrit le code. +Cela vous permet d'écrire plusieurs lignes de code pour effectuer un workflow compliqué, +mais ces mêmes lignes s'exécuteront sur Firefox, +Internet Explorer, Chrome et tous les autres navigateurs pris en charge. + +### Outils et support + +L'approche de conception minimaliste de Selenium lui confère +polyvalence à inclure en tant que composant dans des applications plus importantes. +L'infrastructure environnante fournie sous l'égide du sélénium +vous donne les outils pour assembler +votre [grille de navigateurs] ({{}}) +afin que les tests puissent être exécutés sur différents navigateurs et plusieurs systèmes d'exploitation +sur une gamme de machines. + +Imaginez une banque d'ordinateurs dans votre salle de serveurs ou votre centre de données +allumer tous les navigateurs en même temps +frapper les liens, les formulaires de votre site, +et tables & mdash; tester votre application 24h / 24. +Grâce à l'interface de programmation simple +fourni pour les langues les plus courantes, +ces tests se dérouleront sans relâche en parallèle, +vous faire rapport en cas d'erreur. + +C'est un objectif pour aider à en faire une réalité pour vous, +en fournissant aux utilisateurs des outils et de la +documentation pour non seulement contrôler les navigateurs, +mais pour faciliter la mise à l'échelle et le déploiement de telles grilles. + +### Qui utilise le sélénium + +Beaucoup des entreprises les plus importantes au monde +ont adopté Selenium pour leurs tests sur navigateur, +remplaçant souvent des efforts de plusieurs années impliquant d'autres outils propriétaires. +À mesure qu'elle gagne en popularité, ses exigences et ses défis se multiplient. + +Alors que le Web devient plus compliqué +et de nouvelles technologies sont ajoutées aux sites Web, +c'est la mission de ce projet de les suivre autant que possible. +Être un projet open source, +ce soutien est assuré grâce au généreux don de temps de nombreux bénévoles, +chacun a un "travail de jour". + +Une autre mission du projet est d'encourager +plus de volontaires pour participer à cet effort, +et construire une communauté forte +afin que le projet puisse continuer à +suivre les technologies émergentes +et restent une plate-forme dominante pour +l'automatisation des tests fonctionnels. + + +### Histoire + +Lorsque Selenium 1 est sorti en 2004, +il n'était pas nécessaire de réduire le temps passé +vérification manuelle d'un comportement cohérent dans le front-end d'une application Web. +Il a utilisé les outils disponibles à l'époque +et s'est fortement appuyé sur l'injection de JavaScript dans la page Web testée +pour émuler l'interaction d'un utilisateur. + +Bien que JavaScript soit un bon outil pour vous permettre d'introspecter les propriétés du DOM +et de faire certaines observations côté client que vous ne seriez pas en mesure de faire autrement, +il ne répond pas à la capacité de reproduire naturellement les interactions d'un utilisateur +comme si la souris et le clavier étaient utilisés. + +Depuis lors, le sélénium a grandi et mûri beaucoup, +dans un outil largement utilisé par de nombreux & mdash; sinon la plupart des & mdash; +les plus grandes organisations du monde. +Selenium est passé d'une boîte à outils d'automatisation de tests homebrewed développée à Thoughtworks +pour un public niché et un cas d'utilisation spécifique, +à la bibliothèque d'automatisation du navigateur _de facto_ du monde. + +Tout comme Selenium RC utilisait les outils du commerce disponibles à l'époque, +[Selenium WebDriver] ({{}}) perpétue cette tradition en prenant +la partie d'interaction du navigateur avec le gazon du vendeur du navigateur +et en leur demandant de prendre la responsabilité des implémentations back-end, orientées navigateur. +Récemment, ce travail est devenu un processus de normalisation du W3C +où l'objectif est de transformer le composant WebDriver dans Selenium +dans la bibliothèque de contrôle à distance _du jeur_ pour les agents utilisateurs. \ No newline at end of file From 22b861d1a374c2ae13352c5e753f75c52ca89bc1 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Sun, 26 Jan 2020 22:00:25 +0530 Subject: [PATCH 08/10] Modify: Translated[EN-FR] introduction-> types of testing Signed-off-by: Sri Harsha --- .../introduction/types_of_testing.fr.md | 175 +++++++++--------- 1 file changed, 86 insertions(+), 89 deletions(-) diff --git a/docs_source_files/content/introduction/types_of_testing.fr.md b/docs_source_files/content/introduction/types_of_testing.fr.md index b11e6426134a..f06b5d175d26 100644 --- a/docs_source_files/content/introduction/types_of_testing.fr.md +++ b/docs_source_files/content/introduction/types_of_testing.fr.md @@ -3,120 +3,117 @@ title: "Types de test" weight: 3 --- -{{% notice info %}} - Page being translated from -English to French. Do you speak French? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -## Acceptance testing -This type of test is done to determine if a product's -feature matches its requirements. -This generally involves the customer's feedback or specification. - -For web applications, the automation of this testing can be done -directly with Selenium by simulating user expected behavior. -This simulation could be done by record/playback or through the -different supported languages as explained in this documentation. -Note: Acceptance testing is a subtype of **_functional testing_**, -which some people might also refer to. +## Test d'acceptation +Ce type de test est effectué pour déterminer si un produit +fonction correspond à ses besoins. +Cela implique généralement les commentaires ou les spécifications du client. + +Pour les applications web, l'automatisation de ces tests peut se faire +directement avec Selenium en simulant le comportement attendu de l'utilisateur. +Cette simulation peut être effectuée par enregistrement / lecture ou par +différentes langues prises en charge comme expliqué dans cette documentation. +Remarque: les tests d'acceptation sont un sous-type de **_tests fonctionnels_**, +auquel certaines personnes pourraient également se référer. -### Functional testing -This type of test is done to determine if a product's -feature functions properly, without issues. +### Test fonctionel + +Ce type de test est effectué pour déterminer si un produit est +la fonctionnalité fonctionne bien, sans problèmes. -This generally include: the tests work without errors -(404, exceptions...), in an usable way (right redirections), -in an accessible way and matching its specifications -(see **_acceptance testing_** above). +Cela comprend généralement: les tests fonctionnent sans erreur +(404, exceptions ...), de manière utilisable (redirection droite), +de manière accessible et correspondant à ses spécifications +(voir **_test d'acceptation_** ci-dessus). + +Pour les applications Web, l'automatisation de ces tests peut être +fait directement avec Selenium en simulant les rendements attendus. +Cette simulation peut être effectuée par enregistrement / lecture ou par +les différentes langues prises en charge comme expliqué dans cette documentation. -For web applications, the automation of this testing can be -done directly with Selenium by simulating expected returns. -This simulation could be done by record/playback or through -the different supported languages as explainedin this documentation. +### Test de performance -### Performance testing -As its name indicates, performance tests are done -to measure how well an application is performing. +Comme son nom l'indique, des tests de performances sont effectués +pour mesurer la performance d'une application. -There are two main sub-types for performance testing: +Il existe deux sous-types principaux pour les tests de performances: #### Load testing -Load testing is done to verify how well the -application works under different defined loads -(usually a particular number of users connected at once) +Des tests de charge sont effectués pour vérifier la +l'application fonctionne sous différentes charges définies +(généralement un nombre particulier d'utilisateurs connectés en même temps) -#### Stress testing -Stress testing is done to verify how well the -application works under stress (or above the maximum supported load). +#### Tests de résistance +Des tests de résistance sont effectués pour vérifier la +l'application fonctionne sous contrainte (ou au-dessus de la charge maximale supportée). -Generally, performance tests are done by executing some -Selenium written tests simulating different users -hitting a particular function on the web app and -retrieving some meaningful measurements. +En règle générale, les tests de performances sont effectués en exécutant certains +Test écrit de sélénium simulant différents utilisateurs +frapper une fonction particulière sur l'application Web et +récupérer des mesures significatives. -This is generally done by other tools that retrieve the metrics. -One such tool is **_JMeter_**. +Cela se fait généralement par d'autres outils qui récupèrent les métriques. +Un tel outil est **_JMeter_**. -For a web application, details to measure include -throughput, latency, data loss, individual component loading times... +Pour une application Web, les détails à mesurer incluent +débit, latence, perte de données, temps de chargement des composants individuels ... -Note 1: All browsers have a performance tab in their -developers' tools section (accessible by pressing F12) +Remarque 1: tous les navigateurs ont un onglet de performances dans leur +section des outils des développeurs (accessible en appuyant sur F12) -Note 2: is a subtype of **_non-functional testing_** -as this is generally measured per system and not per function/feature. +Remarque 2: est un sous-type de **_tests non fonctionnels_** +car cela est généralement mesuré par système et non par fonction / caractéristique. -### Regression testing -This testing is generally done after a change, fix or feature addition. +### Les tests de régression +Ce test est généralement effectué après un changement, un correctif ou un ajout de fonctionnalité. -To ensure that the change has not broken any of the existing -functionality, some already executed tests are executed again. +Pour s'assurer que le changement n'a rompu aucun des +fonctionnalité, certains tests déjà exécutés sont exécutés à nouveau. -The set of re-executed tests can be full or partial -and can include several different types, depending -on the application and development team. +L'ensemble des tests réexécutés peut être complet ou partiel +et peut inclure plusieurs types différents, selon +sur l'équipe d'application et de développement. -### Test driven development (TDD) -Rather than a test type per se, TDD is an iterative -development methodology in which tests drive the design of a feature. +### Développement piloté par les tests (TDD) +Plutôt qu'un type de test en soi, le TDD est un itératif +méthodologie de développement dans laquelle les tests pilotent la conception d'une fonctionnalité. + +Chaque cycle commence par la création d'un ensemble de tests unitaires qui +la fonctionnalité doit réussir (ce qui devrait échouer lors de sa première exécution). -Each cycle starts by creating a set of unit tests that -the feature should pass (which should fail their first time executed). +Après cela, le développement a lieu pour faire passer les tests. +Les tests sont exécutés à nouveau en commençant un autre cycle +et ce processus se poursuit jusqu'à ce que tous les tests soient réussis. -After this, development takes place to make the tests pass. -The tests are executed again starting another cycle -and this process continues until all tests are passing. +Cela vise à accélérer le développement d'une application +basé sur le fait que les défauts sont moins coûteux plus tôt ils sont trouvés. -This aims to speed up the development of an application -based on the fact that defects are less costly the earlier they are found. +### Développement axé sur le comportement (BDD) -### Behavior-driven development (BDD) -BDD is also an iterative development methodology -based on above (TDD) in which the goal is to involve -all the parties in the development of an application. +BDD est également une méthodologie de développement itérative +basé sur ci-dessus (TDD) dans lequel le but est d'impliquer +toutes les parties dans le développement d'une application. -Each cycle starts by creating some specifications -(which should fail). Then create the failing unit -tests (which should also fail) and then create the development. +Chaque cycle commence par la création de quelques spécifications +(qui devrait échouer). Créez ensuite l'unité défaillante +tests (qui devraient également échouer), puis créer le développement. -This cycle is repeated until all type of tests are passing. +Ce cycle est répété jusqu'à ce que tous les types de tests réussissent. -In order to do so, a specification language is -used. It should be understandable by all parties and -simple, standard and explicit. -Most tools use **_Gherkin_** as this language. +Pour ce faire, un langage de spécification est +utilisé. Il doit être compréhensible par toutes les parties et +simple, standard et explicite. +La plupart des outils utilisent **_Gherkin_** comme langue. -The goal is to be able to detect even more errors -than TDD by targeting potential acceptance errors -too and make communication between parties smoother. +L'objectif est de pouvoir détecter encore plus d'erreurs +que TDD en ciblant les erreurs d'acceptation potentielles +aussi et rendre la communication entre les parties plus fluide. -A set of tools are currently available -to write the specifications and match them with code functions, -such as **_Cucumber_** or **_SpecFlow._** +Un ensemble d'outils est actuellement disponible +écrire les spécifications et les associer aux fonctions de code, +tels que **_Concombre_** ou **_SpecFlow._ ** -A set of tools are built on top of Selenium to make this process -even faster by directly transform the BDD specifications into -executable code. -Some of these are **_JBehave, Capybara and Robot Framework_**. +Un ensemble d'outils est construit sur Selenium pour rendre ce processus +encore plus rapide en transformant directement les spécifications BDD en +code exécutable. +Certains d'entre eux sont **_JBehave, Capybara et Robot Framework_**. From 9548e2d3d14f57d5ae28cf49b609f0041c15abac Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Sun, 26 Jan 2020 22:03:09 +0530 Subject: [PATCH 09/10] Fix: Updating text to bold Signed-off-by: Sri Harsha --- docs_source_files/content/introduction/types_of_testing.fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs_source_files/content/introduction/types_of_testing.fr.md b/docs_source_files/content/introduction/types_of_testing.fr.md index f06b5d175d26..86f102f4ef3c 100644 --- a/docs_source_files/content/introduction/types_of_testing.fr.md +++ b/docs_source_files/content/introduction/types_of_testing.fr.md @@ -110,7 +110,7 @@ aussi et rendre la communication entre les parties plus fluide. Un ensemble d'outils est actuellement disponible écrire les spécifications et les associer aux fonctions de code, -tels que **_Concombre_** ou **_SpecFlow._ ** +tels que **_Concombre_** ou **_SpecFlow._** Un ensemble d'outils est construit sur Selenium pour rendre ce processus encore plus rapide en transformant directement les spécifications BDD en From bb0cd1e3cee758e7743be7b8dc0687c20804893c Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Sat, 8 Feb 2020 22:32:32 +0530 Subject: [PATCH 10/10] Add: Ruby code samples for moveToElement and moveByOffset in mouse actions in detail Signed-off-by: Sri Harsha --- ...mouse_and_keyboard_actions_in_detail.de.md | 31 +++++++++++++++++-- ...mouse_and_keyboard_actions_in_detail.en.md | 31 +++++++++++++++++-- ...mouse_and_keyboard_actions_in_detail.es.md | 31 +++++++++++++++++-- ...mouse_and_keyboard_actions_in_detail.fr.md | 31 +++++++++++++++++-- ...mouse_and_keyboard_actions_in_detail.ja.md | 31 +++++++++++++++++-- ...mouse_and_keyboard_actions_in_detail.ko.md | 31 +++++++++++++++++-- ...mouse_and_keyboard_actions_in_detail.nl.md | 31 +++++++++++++++++-- ...se_and_keyboard_actions_in_detail.zh-cn.md | 31 +++++++++++++++++-- 8 files changed, 232 insertions(+), 16 deletions(-) diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md index c7b517cd1abc..57d8fa2adec9 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.de.md @@ -471,7 +471,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -596,7 +608,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md index 9613da993d74..b4e25a34aff4 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.en.md @@ -465,7 +465,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -590,7 +602,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md index 779e2432ea19..a82a134bced3 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.es.md @@ -472,7 +472,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -597,7 +609,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md index b31a8a35ec7b..b278b46d4340 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.fr.md @@ -471,7 +471,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -596,7 +608,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md index 308a2febdd05..b35ba63e8fec 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ja.md @@ -470,7 +470,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -595,7 +607,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md index 6291e339cefd..4f473ef27287 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.ko.md @@ -471,7 +471,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -596,7 +608,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md index 0a5f4c541ce9..ccfdf42232a4 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.nl.md @@ -471,7 +471,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -596,7 +608,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); diff --git a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md index 1a32e7079c64..10ec78ac4b3d 100644 --- a/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md +++ b/docs_source_files/content/support_packages/mouse_and_keyboard_actions_in_detail.zh-cn.md @@ -470,7 +470,19 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Performs mouse move action onto the element + driver.action.move_to(gmail_link).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver'); @@ -595,7 +607,22 @@ namespace SeleniumApp } {{< / code-panel >}} {{< code-panel language="ruby" >}} -# Please raise a PR +require 'selenium-webdriver' +driver = Selenium::WebDriver.for :chrome + +begin + # Navigate to Url + driver.get 'https://www.google.com' + # Store 'Gmail' anchor web element + gmail_link = driver.find_element(link_text: 'Gmail') + # Capture x and y offset positions of element + x_offset = gmail_link.rect.x + y_offset = gmail_link.rect.y + # Performs mouse move action onto the offset position + driver.action.move_to_location(x_offset, y_offset).perform +ensure + driver.quit +end {{< / code-panel >}} {{< code-panel language="javascript" >}} const {Builder, By} = require('selenium-webdriver');