From 25a4d772845b50eaf90873d09c57d218ac2c8be4 Mon Sep 17 00:00:00 2001 From: Nisim761 Date: Tue, 9 Jul 2024 15:00:21 +0300 Subject: [PATCH 1/3] Fixing consistency --- .../webdriver/elements/locators.en.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/locators.en.md b/website_and_docs/content/documentation/webdriver/elements/locators.en.md index 3765f88dbc02..05a47503a4e7 100644 --- a/website_and_docs/content/documentation/webdriver/elements/locators.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/locators.en.md @@ -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 us above mentioned ways, using which we can locate an element on the +page. To understand how to create a locator we will use the following HTML snippet. ```html @@ -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 >}} @@ -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 +A HTML document can be considered as a 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. +Or the Xpath could be relative. Example - //input[@name='fname']. This will return the +first name text box. Let us create a locator for female radio button using XPath. {{< tabpane langEqualsHeader=true >}} {{< badge-examples >}} @@ -343,8 +343,8 @@ 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 either 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. @@ -437,7 +437,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 >}} From 00a3f00dd584ca09f46ef7c42922ea7199169d3f Mon Sep 17 00:00:00 2001 From: Nisim761 Date: Tue, 9 Jul 2024 15:11:29 +0300 Subject: [PATCH 2/3] Better readibility --- .../content/documentation/webdriver/elements/locators.en.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/locators.en.md b/website_and_docs/content/documentation/webdriver/elements/locators.en.md index 05a47503a4e7..399b4311ed85 100644 --- a/website_and_docs/content/documentation/webdriver/elements/locators.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/locators.en.md @@ -298,8 +298,8 @@ From the above HTML snippet shared, lets identify the link, using its html tag " A HTML document can be considered as a 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 +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 >}} From 5b3ba8405cca009a5fc66598e70cc546c624adf6 Mon Sep 17 00:00:00 2001 From: Nisim761 Date: Tue, 9 Jul 2024 15:15:27 +0300 Subject: [PATCH 3/3] Fix grammar and clarity --- .../documentation/webdriver/elements/locators.en.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/locators.en.md b/website_and_docs/content/documentation/webdriver/elements/locators.en.md index 399b4311ed85..979546a02c3c 100644 --- a/website_and_docs/content/documentation/webdriver/elements/locators.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/locators.en.md @@ -34,7 +34,7 @@ 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 an element on the +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 @@ -295,7 +295,7 @@ 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. For example, /html/form/input[1]. This will return the male radio button. @@ -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 either 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 +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.