Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added locator section for Bug #1393 #1880

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ first name text box. Let us create locator for female radio button using xpath.
{{< /tab >}}
{{< tab header="CSharp" >}}
var driver = new ChromeDriver();
driver.FindElement(By.Xpath("//input[@value='f']"));
driver.FindElement(By.Xpath("//input[@value='f']"));
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L35" >}}
Expand All @@ -324,11 +324,45 @@ first name text box. Let us create locator for female radio button using xpath.
const loc = await driver.findElement(By.xpath('//input[@value='f']'));
{{< /tab >}}
{{< tab header="Kotlin" >}}
import org.openqa.selenium.By
val driver = ChromeDriver()
val loc: WebElement = driver.findElement(By.xpath('//input[@value='f']'))
val loc: WebElement = driver.findElement(By.xpath('//input[@value='f']'))
{{< /tab >}}
{{< /tabpane >}}

## Utilizing Locators

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>

{{< tabpane langEqualsHeader=true >}}
{{< badge-examples >}}
{{< tab header="Java" >}}
import org.openqa.selenium.By;
WebDriver driver = new ChromeDriver();
driver.findElement(By.className("information"));
{{< /tab >}}
{{< tab header="Python" >}}
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.find_element(By.CLASS_NAME, "information")
{{< /tab >}}
{{< tab header="CSharp" >}}
var driver = new ChromeDriver();
driver.FindElement(By.ClassName("information"));
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
let driver = await new Builder().forBrowser('chrome').build();
const loc = await driver.findElement(By.className('information'));
{{< /tab >}}
{{< tab header="Kotlin" >}}
import org.openqa.selenium.By
val driver = ChromeDriver()
val loc: WebElement = driver.findElement(By.className("information"))
{{< /tab >}}
{{< /tabpane >}}

## Relative Locators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,40 @@ first name text box. Let us create locator for female radio button using xpath.
{{< /tab >}}
{{< /tabpane >}}

## Utilizing Locators

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>

{{< tabpane langEqualsHeader=true >}}
{{< badge-examples >}}
{{< tab header="Java" >}}
import org.openqa.selenium.By;
WebDriver driver = new ChromeDriver();
driver.findElement(By.className("information"));
{{< /tab >}}
{{< tab header="Python" >}}
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.find_element(By.CLASS_NAME, "information")
{{< /tab >}}
{{< tab header="CSharp" >}}
var driver = new ChromeDriver();
driver.FindElement(By.ClassName("information"));
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
let driver = await new Builder().forBrowser('chrome').build();
const loc = await driver.findElement(By.className('information'));
{{< /tab >}}
{{< tab header="Kotlin" >}}
import org.openqa.selenium.By
val driver = ChromeDriver()
val loc: WebElement = driver.findElement(By.className("information"))
{{< /tab >}}
{{< /tabpane >}}



## 相対ロケーター
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,39 @@ first name text box. Let us create locator for female radio button using xpath.
{{< /tab >}}
{{< /tabpane >}}

## Utilizing Locators

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>

{{< tabpane langEqualsHeader=true >}}
{{< badge-examples >}}
{{< tab header="Java" >}}
import org.openqa.selenium.By;
WebDriver driver = new ChromeDriver();
driver.findElement(By.className("information"));
{{< /tab >}}
{{< tab header="Python" >}}
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.find_element(By.CLASS_NAME, "information")
{{< /tab >}}
{{< tab header="CSharp" >}}
var driver = new ChromeDriver();
driver.FindElement(By.ClassName("information"));
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
let driver = await new Builder().forBrowser('chrome').build();
const loc = await driver.findElement(By.className('information'));
{{< /tab >}}
{{< tab header="Kotlin" >}}
import org.openqa.selenium.By
val driver = ChromeDriver()
val loc: WebElement = driver.findElement(By.className("information"))
{{< /tab >}}
{{< /tabpane >}}

## Relative Locators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,39 @@ first name text box. Let us create locator for female radio button using xpath.
{{< /tab >}}
{{< /tabpane >}}

## Utilizing Locators

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>

{{< tabpane langEqualsHeader=true >}}
{{< badge-examples >}}
{{< tab header="Java" >}}
import org.openqa.selenium.By;
WebDriver driver = new ChromeDriver();
driver.findElement(By.className("information"));
{{< /tab >}}
{{< tab header="Python" >}}
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.find_element(By.CLASS_NAME, "information")
{{< /tab >}}
{{< tab header="CSharp" >}}
var driver = new ChromeDriver();
driver.FindElement(By.ClassName("information"));
{{< /tab >}}
{{< tab header="Ruby" text=true >}}
{{< gh-codeblock path="examples/ruby/spec/elements/locators_spec.rb#L7" >}}
{{< /tab >}}
{{< tab header="JavaScript" >}}
let driver = await new Builder().forBrowser('chrome').build();
const loc = await driver.findElement(By.className('information'));
{{< /tab >}}
{{< tab header="Kotlin" >}}
import org.openqa.selenium.By
val driver = ChromeDriver()
val loc: WebElement = driver.findElement(By.className("information"))
{{< /tab >}}
{{< /tabpane >}}

## Relative Locators

Expand Down
Loading