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

Fixing consistency and English grammar #1804

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
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 @@ -34,8 +34,8 @@ Selenium provides support for these 8 traditional location strategies in WebDriv
## Creating Locators

To work on a web element using Selenium, we need to first locate it on the web page.
Selenium provides us above mentioned ways, using which we can locate element on the
page. To understand and create locator we will use the following HTML snippet.
Selenium provides the above-mentioned methods, which we can use to locate an element on the
page. To understand how to create a locator we will use the following HTML snippet.

```html
<html>
Expand Down Expand Up @@ -105,7 +105,7 @@ available in Selenium.
CSS is the language used to style HTML pages. We can use css selector locator strategy
to identify the element on the page. If the element has an id, we create the locator
as css = #id. Otherwise the format we follow is css =[attribute=value] .
Let us see an example from above HTML snippet. We will create locator for First Name
Let us see an example from above HTML snippet. We will create a locator for First Name
textbox, using css.

{{< tabpane langEqualsHeader=true >}}
Expand Down Expand Up @@ -295,12 +295,12 @@ From the above HTML snippet shared, lets identify the link, using its html tag "

## xpath

A HTML document can be considered as a XML document, and then we can use xpath
An HTML document can be considered as an XML document, and then we can use XPath
which will be the path traversed to reach the element of interest to locate the element.
The XPath could be absolute xpath, which is created from the root of the document.
Example - /html/form/input[1]. This will return the male radio button.
Or the xpath could be relative. Example- //input[@name='fname']. This will return the
first name text box. Let us create locator for female radio button using xpath.
For example, /html/form/input[1]. This will return the male radio button.
Alternatively, the XPath can be relative. For example, //input[@name='fname'] will return the
first name text box. Let us create a locator for female radio button using XPath.

{{< tabpane langEqualsHeader=true >}}
{{< badge-examples >}}
Expand Down Expand Up @@ -343,8 +343,7 @@ Selenium uses the JavaScript function
[getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)
to determine the size and position of elements on the page, and can use this information to locate neighboring elements.

Relative locator methods can take as the argument for the point of origin, either a previously located element reference,
or another locator. In these examples we'll be using locators only, but you could swap the locator in the final method with
Relative locator methods can take a previously located element reference, or another locator, as the argument for the point of origin. In these examples we'll be using locators only, but you could swap the locator in the final method with
an element object and it will work the same.

Let us consider the below example for understanding the relative locators.
Expand Down Expand Up @@ -437,7 +436,7 @@ val cancelLocator = RelativeLocator.with(By.tagName("button")).toLeftOf(By.id("s
#### Right of

If the submit button is not easily identifiable for some reason, but the cancel button element is,
we can locate the submit button element using the fact that it is a "button" element "to the right of" the cancel element.
we can locate the submit button element using the fact that it is a "button" element to the "right of" the cancel element.

{{< tabpane langEqualsHeader=true >}}
{{< badge-examples >}}
Expand Down