Skip to content

Commit 7ba611e

Browse files
authored
added locator section for Bug #1393 (#1880)
added section for ticket 1393 [deploy site]
1 parent 59659f7 commit 7ba611e

File tree

4 files changed

+134
-2
lines changed

4 files changed

+134
-2
lines changed

website_and_docs/content/documentation/webdriver/elements/locators.en.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ first name text box. Let us create locator for female radio button using xpath.
314314
{{< /tab >}}
315315
{{< tab header="CSharp" >}}
316316
var driver = new ChromeDriver();
317-
driver.FindElement(By.Xpath("//input[@value='f']"));
317+
driver.FindElement(By.Xpath("//input[@value='f']"));
318318
{{< /tab >}}
319319
{{< tab header="Ruby" text=true >}}
320320
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L35" >}}
@@ -324,11 +324,45 @@ first name text box. Let us create locator for female radio button using xpath.
324324
const loc = await driver.findElement(By.xpath('//input[@value='f']'));
325325
{{< /tab >}}
326326
{{< tab header="Kotlin" >}}
327+
import org.openqa.selenium.By
327328
val driver = ChromeDriver()
328-
val loc: WebElement = driver.findElement(By.xpath('//input[@value='f']'))
329+
val loc: WebElement = driver.findElement(By.xpath('//input[@value='f']'))
329330
{{< /tab >}}
330331
{{< /tabpane >}}
331332

333+
## Utilizing Locators
334+
335+
The FindElement makes using locators a breeze! For most languages, all you need to do is utilize `webdriver.common.by.By`, however in others it's as simple as setting a parameter in the FindElement function>
336+
337+
{{< tabpane langEqualsHeader=true >}}
338+
{{< badge-examples >}}
339+
{{< tab header="Java" >}}
340+
import org.openqa.selenium.By;
341+
WebDriver driver = new ChromeDriver();
342+
driver.findElement(By.className("information"));
343+
{{< /tab >}}
344+
{{< tab header="Python" >}}
345+
from selenium.webdriver.common.by import By
346+
driver = webdriver.Chrome()
347+
driver.find_element(By.CLASS_NAME, "information")
348+
{{< /tab >}}
349+
{{< tab header="CSharp" >}}
350+
var driver = new ChromeDriver();
351+
driver.FindElement(By.ClassName("information"));
352+
{{< /tab >}}
353+
{{< tab header="Ruby" text=true >}}
354+
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
355+
{{< /tab >}}
356+
{{< tab header="JavaScript" >}}
357+
let driver = await new Builder().forBrowser('chrome').build();
358+
const loc = await driver.findElement(By.className('information'));
359+
{{< /tab >}}
360+
{{< tab header="Kotlin" >}}
361+
import org.openqa.selenium.By
362+
val driver = ChromeDriver()
363+
val loc: WebElement = driver.findElement(By.className("information"))
364+
{{< /tab >}}
365+
{{< /tabpane >}}
332366

333367
## Relative Locators
334368

website_and_docs/content/documentation/webdriver/elements/locators.ja.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,40 @@ first name text box. Let us create locator for female radio button using xpath.
320320
{{< /tab >}}
321321
{{< /tabpane >}}
322322

323+
## Utilizing Locators
324+
325+
The FindElement makes using locators a breeze! For most languages, all you need to do is utilize `webdriver.common.by.By`, however in others it's as simple as setting a parameter in the FindElement function>
326+
327+
{{< tabpane langEqualsHeader=true >}}
328+
{{< badge-examples >}}
329+
{{< tab header="Java" >}}
330+
import org.openqa.selenium.By;
331+
WebDriver driver = new ChromeDriver();
332+
driver.findElement(By.className("information"));
333+
{{< /tab >}}
334+
{{< tab header="Python" >}}
335+
from selenium.webdriver.common.by import By
336+
driver = webdriver.Chrome()
337+
driver.find_element(By.CLASS_NAME, "information")
338+
{{< /tab >}}
339+
{{< tab header="CSharp" >}}
340+
var driver = new ChromeDriver();
341+
driver.FindElement(By.ClassName("information"));
342+
{{< /tab >}}
343+
{{< tab header="Ruby" text=true >}}
344+
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
345+
{{< /tab >}}
346+
{{< tab header="JavaScript" >}}
347+
let driver = await new Builder().forBrowser('chrome').build();
348+
const loc = await driver.findElement(By.className('information'));
349+
{{< /tab >}}
350+
{{< tab header="Kotlin" >}}
351+
import org.openqa.selenium.By
352+
val driver = ChromeDriver()
353+
val loc: WebElement = driver.findElement(By.className("information"))
354+
{{< /tab >}}
355+
{{< /tabpane >}}
356+
323357

324358

325359
## 相対ロケーター

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,39 @@ first name text box. Let us create locator for female radio button using xpath.
323323
{{< /tab >}}
324324
{{< /tabpane >}}
325325

326+
## Utilizing Locators
326327

328+
The FindElement makes using locators a breeze! For most languages, all you need to do is utilize `webdriver.common.by.By`, however in others it's as simple as setting a parameter in the FindElement function>
329+
330+
{{< tabpane langEqualsHeader=true >}}
331+
{{< badge-examples >}}
332+
{{< tab header="Java" >}}
333+
import org.openqa.selenium.By;
334+
WebDriver driver = new ChromeDriver();
335+
driver.findElement(By.className("information"));
336+
{{< /tab >}}
337+
{{< tab header="Python" >}}
338+
from selenium.webdriver.common.by import By
339+
driver = webdriver.Chrome()
340+
driver.find_element(By.CLASS_NAME, "information")
341+
{{< /tab >}}
342+
{{< tab header="CSharp" >}}
343+
var driver = new ChromeDriver();
344+
driver.FindElement(By.ClassName("information"));
345+
{{< /tab >}}
346+
{{< tab header="Ruby" text=true >}}
347+
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
348+
{{< /tab >}}
349+
{{< tab header="JavaScript" >}}
350+
let driver = await new Builder().forBrowser('chrome').build();
351+
const loc = await driver.findElement(By.className('information'));
352+
{{< /tab >}}
353+
{{< tab header="Kotlin" >}}
354+
import org.openqa.selenium.By
355+
val driver = ChromeDriver()
356+
val loc: WebElement = driver.findElement(By.className("information"))
357+
{{< /tab >}}
358+
{{< /tabpane >}}
327359

328360
## Relative Locators
329361

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,39 @@ first name text box. Let us create locator for female radio button using xpath.
323323
{{< /tab >}}
324324
{{< /tabpane >}}
325325

326+
## Utilizing Locators
326327

328+
The FindElement makes using locators a breeze! For most languages, all you need to do is utilize `webdriver.common.by.By`, however in others it's as simple as setting a parameter in the FindElement function>
329+
330+
{{< tabpane langEqualsHeader=true >}}
331+
{{< badge-examples >}}
332+
{{< tab header="Java" >}}
333+
import org.openqa.selenium.By;
334+
WebDriver driver = new ChromeDriver();
335+
driver.findElement(By.className("information"));
336+
{{< /tab >}}
337+
{{< tab header="Python" >}}
338+
from selenium.webdriver.common.by import By
339+
driver = webdriver.Chrome()
340+
driver.find_element(By.CLASS_NAME, "information")
341+
{{< /tab >}}
342+
{{< tab header="CSharp" >}}
343+
var driver = new ChromeDriver();
344+
driver.FindElement(By.ClassName("information"));
345+
{{< /tab >}}
346+
{{< tab header="Ruby" text=true >}}
347+
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
348+
{{< /tab >}}
349+
{{< tab header="JavaScript" >}}
350+
let driver = await new Builder().forBrowser('chrome').build();
351+
const loc = await driver.findElement(By.className('information'));
352+
{{< /tab >}}
353+
{{< tab header="Kotlin" >}}
354+
import org.openqa.selenium.By
355+
val driver = ChromeDriver()
356+
val loc: WebElement = driver.findElement(By.className("information"))
357+
{{< /tab >}}
358+
{{< /tabpane >}}
327359

328360
## Relative Locators
329361

0 commit comments

Comments
 (0)