P7 - Different Locators in Selenium WebDriver | Selenium | Java |

preview_player
Показать описание
In this video, I have explained about "Different Locators available in Selenium WebDriver".

Selenium WebDriver is an open-source tool for automated testing of web apps across many browsers.

One of the most fundamental techniques to learn when using WebDriver is how to find elements on the page. WebDriver offers a number of built-in selector types(locators) to achieve the same.

⭐ Element Selection Strategies or Locators ⭐
There are eight different built-in element location strategies or locators available in WebDriver:
id -- Locates elements whose ID attribute matches the search value
name -- Locates elements whose NAME attribute matches the search value
class name -- Locates elements whose class name contains the search value
tag name -- Locates elements whose tag name matches the search value
CSS selector -- Locates elements matching a CSS selector
XPath -- Locates elements matching an XPath expression
link text -- Locates anchor elements whose visible text matches the search value
partial link text -- Locates anchor elements whose visible text contains the search value. If multiple elements are matching, only the first one will be selected.

In general, if HTML IDs are available, unique, and consistently predictable, they are the preferred method for locating an element on a page. They tend to work very quickly and forego much processing that comes with complicated DOM traversals.

If unique IDs are unavailable, a well-written CSS selector is a preferred method of locating an element. XPath works as well as CSS selectors, but the syntax is complicated and frequently difficult to debug. Though XPath selectors are very flexible, they are typically not performance tested by browser vendors and tend to be quite slow.

Selection strategies based on linkText and partialLinkText have drawbacks in that they only work on link elements. Additionally, they call down to XPath selectors internally in WebDriver.

Tag name can be a dangerous way to locate elements. There are frequently multiple elements of the same tag present on the page. This is mostly useful when calling the findElements(By) method which returns a collection of elements.

The recommendation is to keep your locators as compact and readable as possible. Asking WebDriver to traverse the DOM structure is an expensive operation and the more you can narrow the scope of your search, the better.

-- Example: --

As seen in the example, locating elements in WebDriver is done on the WebDriver instance object. The findElement(By) method returns another fundamental object type, the WebElement.

WebDriver -- represents the browser
WebElement -- represents a particular DOM node (a control, e.g. a link or input field, etc.)

You can find the program used in this video at the below location: 👇

==============================================
==============================================
Connect us @
==============================================
==============================================
🙏 Please Subscribe🔔 to start learning for FREE now, Also help your friends in learning the best by suggesting this channel.

#hyrtutorialstelugu #selenium #telugu #java
Рекомендации по теме
Комментарии
Автор

Thanks anna i learnt java through u r channel

naveenv
Автор

Eagerly waiting for your videos for BDD & CUCUMBER in Telugu

munindharr
Автор

excellant explanations, kudos to Giri

vijaymadur
Автор

I watched more YouTube videos but i couldn't understand but one's i watched your videos i am easily understanding thanks you so much sir

AnilKumar-pneb
Автор

Yadagiri anna, the way you teach is Super goof. Crystal clear Explaination. Any plans to teach SQL anna. If possible make classes on SQL

vepurikartheek
Автор

Hi reddy bro.. nice Explaination in Telugu. it is very usefull to me. thank you bro

maddiliramesh
Автор

Brother chala triptika feel auchosindi ni video choosee tarbata. Induku kuta tutorial upload chaiaru. Nitoo kalpi oka financial/banking project chse tarbata chala confidence ooche huntaru anukunaanu. Dagarlo chesai brother. (I am trying to comment in Telugu, I am from Nepal)

SoftJavaPython
Автор

Hi, Do you have any plans for doing API testing?

ArjunPapisetty
Автор

Hi bro meeru cucumber protracter in vscode meeda videos cheyandi pls using pagescript

nikhithakrishnam
Автор

dear sir! in which feild/domain you are worked presntly

trinadhmanda
Автор

Hi bro nuvu ee video lo GitHub logo ki element inspect chesinapidu div class ni enduku expand chesi andulo [ a] tag ni enduku lo una class ni use chesaru div lo vuna class use cheyachu kada

nikhithakrishnam
Автор

bro totally super but the web elements are not highlighted, i wrote the same code whatever you write can you please explain that

bhanuprasad.m
Автор

hi bro if you dont mind a small request, , core java and selenium medha interview quations and answers pdf notes provide chestara bro plss

fanmadeguru
Автор

Maven project lo web driver manager dagara error vastundi sir
Plz provide video sir

pavanisannamuri
Автор

Brother could you provide xPaht and cssSelector tutorial links.

SoftJavaPython
Автор

Hi anna. Meru cheypena process follow cheysanu selenium installation cheysanu. But eclipse work kavatledhu.import kavtledhu .Please new updated version tho ela setup cheyali video cheyandi please. 3 days nunchi chala videos chusi try cheysanu but work kavtledhu .please request cheysthunaa.Course practice cheyalakapothunaa brother

varunkumarthoutam
Автор

Explanation wise is very good, but atlast totally getting confused..

victorpremanand
Автор

Still any content is pending to add this list pls let us know
pls refer

munindharr
Автор

Git hub ante enti alanti information kosam link providecheyandi sir inka em em s/w use chesaru avi kuda mention cheyyandi atleast link provide cheyyandi 1st time mi video chuse valla ki ardham kadhu

Archanaparupally
Автор

Entha baga explain chesaru, 88members chusaru 4likes andulo oKati nadhi😡 very bad

Archanaparupally