P7 - Different Locators available in Selenium WebDriver | తెలుగు |
HTML-код
- Опубликовано: 25 апр 2021
- 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: --
WebElement cheese = driver.findElement(By.id("cheese"));
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: 👇
bit.ly/32ReI3h
▶ Next Video link: • P8 - How to handle Tex...
◀ Previous Video Link: • P6 - Auto Download Dri...
↔ Selenium Java in Telugu Playlist link: bit.ly/3tL7Z9S
✴ Checkout my other playlists: bit.ly/3gLIAVL
☕ Buy me a coffee: bit.ly/33ljBWc
👑 Join my RUclips channel to get access to perks:👇
/ @hyrtutorials
==============================================
==============================================
Connect us @
🔗 Website - www.hyrtutorials.com
🔗 Telegram - t.me/hyrtutorials
🔗 Facebook - / hyrtutorials
🔗 LinkedIn - / hyrtutorials
🔗 Twitter - / hyrtutorials
🔗 Instagram - / hyrtutorials
==============================================
==============================================
🙏 Please Subscribe🔔 to start learning for FREE now, Also help your friends in learning the best by suggesting this channel.
#hyrtutorials #selenium #telugu #java
📌 Selenium Java in Telugu Playlist link: bit.ly/3tL7Z9S
✴ Checkout my other playlists: bit.ly/3gLIAVL
☕ Buy me a coffee: bit.ly/33ljBWc
Hi, even my last name is YADAGIRI
thop anna nuv itla ne cheyandi videos masth 👌ardham ayithundhi Thank You very much👍
Thanks buddy 😊
Before i was very afraid of selenium , but after listening to your class i feel confident . nice teaching bro
Chala clear ga chepthunnaru great anna
Thanks buddy 🙂
Thank you for the video sir . U r very talented and u r explanation is awesome
Thankyou 😊
Practice cheyyadam marchipovadhu
good job gurujii thanks a lot for doing this kind of videos in our regional language...
Thanks buddy 😊
Thank you somuch sir. You are helping great. Very useful information. Thank you
Thanks buddy 😊
Nice explanation bro..
Anna super and clear explanation .... Soo easy to learn and thank u Annaya
Thankyou buddy 😊
Thanks Yadagiri Reddy..Nice session..👍
🤝
Sir superb easily understand ur vedios.....
Thanks buddy 🙂
Yes bro u r amazing,no words,thank you
Thanks buddy 😊
All watchers, you can find highlighter script here:
public static void highlight(WebDriver driver, WebElement element) {
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", element);
Yup, now this is handy
Hi..do we need to add any packages for this to work
How to download that code
Really nice ,tq s mch
very good explanation sir. thank you very much.
Thanks buddy 😊
You are doing great job sir
Thanks buddy
Really great explanation...
Thankyou 😊
Thanks for the useful video brother
Always welcome buddy
Thankyou brother usefull information
Welcome
Very useful video thanks alot.
Thanks buddy 😊
very good useful video
Thankyou 😊
Thank you so much brother,you are doing great job keep going👍👍
Thanks and keep watching
@@HYRTutorials sure
Thanks Guruvaa.. 🙂
Happy learning buddy 😊
thank you for the videos
Welcome buddy 😊
Nice explanation sir
Thankyou buddy 😊
Anna knchm chinna ga and clear ga chepu anna chepkuntu velipothunav... Asl thread sleep nti ah elements ela find cheyalii ivvi kudas clear ga chepthe bavundu
learnt a lot from your videos in an very understandable our mother tounge language.
can you please provide highlight methos in description box. its easy to use so asking
This link has all the codes that have been used in this playlist buddy.
github.com/YadaGiriReddy/HYR-Tutorials/tree/master/Selenium%20Java%20in%20Telugu
Nice👏👏👏👏
Thanks 😊
Thank u 🥰🥰
Glad you liked it 😊
Thank you o much bro
Happy learning buddy
Thanku broo
welcome buddy
Super
Thankyou buddy 😊
hi sir great explanation, but sir i need some detail explanation on xpath and css selector is there any video related to this in your play list if yes plz suggest
You can checkout these links for the detailed explanation:
ruclips.net/p/PLacgMXFs7kl-w3RW5IN0eWVIHsYV8uHdz
ruclips.net/p/PLacgMXFs7kl8E5xl-nu_7ZjHN0O4oiFcl
ruclips.net/video/f0oCvbuXmJI/видео.html
Hi ca n we use this webdriver manager java project as well??
Tq sir
Glad you liked it buddy 😊
Hi Sir, Konni videos Verifications checks medha kuda cheyara, mee videos chala bagunai sir
Very soon I will start another series in which I willl be covering that verifications part
in executeScript() what is the 2nd arguement you provided
Web element buddy
Superb explanation anna. But na system na script lo thread work avatled. Error message like unhandled exception ani vastundi em cheyalli??
Send me the script and error screenshot on hyadagirireddytutorials@gmail.com
Hi brother thank you for your information doing good job bro . i have written all the code for this class with the 8 locaters but while i am running the program i can able to see only up to git hub page is opening after that it's not running bro can you please advice to get complete result as you get
Are you getting any errors in the console like nosuch element exception buddy?
Please make selenium series in English for rest of India. We will be very thankful.
Playlist is already available buddy.
Check this page for all of my videos
github.com/YadaGiriReddy/HYR-Tutorials
super testng also telugu lo cheyando brother
Sure buddy
Sir cals unnaya salenium freshers ki
Hi brother,
I recently started watching your vidoes on selenium and I decided that to take up selenium coaching.
If training facility is available please let me know the further process brother.
Thanks in advance.
Upendra
Currently I'm not taking any personal training buddy
Sir I'm carrier gap student I interested IT job any help to me
hi bro i was run code same as you but not able to highlight the text ,can you please guide me ?
Error em vasthundi buddy.
Send me the screenshots on hyadagirireddytutorials@gmail.com
Hello sir...Miru cheppina selenium videos Laptop Lo practice cheyadam valla Emaina use unttundha ??
Practice cheyyakapothe job ela vastundi buddy
Is there any online institutes for functional testing and serinum
No idea buddy
how can i highliht the inputs in web page , where i can get that javascript code ,could u please give that
ruclips.net/video/mTkeNj5tglw/видео.html
in edge browser facebook login page lo tagname chusa ra naku itey kanipichaledhu undha ledha ani doubt undi head tag max chala varuku use cheyaru ani cheparu
tagname anedi lekunda a element ina html lo undadu buddy, check one more time
Hi Giri, Do you have a list of real time scenarios to solve? I see that your website has some practice links but if you have any real time scenarios, it will be helpful. Thanks
You can use any real time website available in internet brother.
If you want to practice then you can use opensource-demo.orangehrmlive.com/
hi ..am facing error with the highlight method..please explain clearly
Can u mention that error here buddy
Anna website lo devoloper tool Ela open cheyali..I mean em click chesaru please reply anna...
Press F12 in your keyboard or right-click and click on inspect element buddy
Hi Bro,
Can you leave the code below for highlight or please correct the code below:
public static void highlight(WebDriver driver, WebElement element) {
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].setAttribute('style','border:5px red solid;background:yellow');"
After yellow text, you have to pass the webelement instance i.e element
@@HYRTutorials i am sorry bro, i am not from coading background.
Can you send me the right one after you edit here...plZ
Hi bro,
Any update on my request plz.
I am on of your follower
jsExecutor.executeScript("arguments[0].setAttribute('style','border:5px red solid;background:yellow');", element);
naku page open avtundi but locations ni identify cheyyatla
Emanna errors vasthunnaya buddy?
Hi broh I need direct training..is it possible..
No bro
I'm not taking any classes currently.
Anyway you can get the same knowledge at free of cost here na
Hlo sir username or email dagara inspect chesthunaru kadandi sir akada oka vella id lekunte .name undi and password ki kuda same unte appudu am cheyali.Ala cheyali chepandi sir
U can either use index or create an xpath by which you can identify the element in a unique way
Tq u sir
In WebDriver suggestions, Why I'm not getting WebDriveManager as suggestion? Can you please tell me this
Checkout this video buddy
ruclips.net/video/oIhRNl5q3OI/видео.html
@@HYRTutorials Thank you 😇
WebDriverManager dagara errors vastundi import ravatam ledhu webDriverManger ki
Watch this video buddy: ruclips.net/video/oIhRNl5q3OI/видео.html
hi sir actually i need manual testing and automation testing full stock pettara plzzz
Only automation testing maathrame unnai buddy at this time
On Ap_testing (postman) video chayandi bro.
i have the plans for that but not immediately
@@HYRTutorials ok bro,I'm waiting & exciting for ur videos. When you have free time for making videos then only u can do .
Git link is not working can u please check once
checked and is working fine buddy
if u r facing any issue with link, send me the screenshot on hyadagirireddytutorials@gmail.com
Sir Div means, can tell me anyone
Div ante division tag.
HTML page ni compartments ga divide cheyyadaniki div use cheskuntam
Sir,Your Github repository link?
github.com/YadaGiriReddy
JavascriptExecutor cannot be resolved to a type I am getting this error. Any one tell me how to resolve this
Can u paste the line which u r using here
@@HYRTutorials It's working now. Imported the package. thank you
That's good
Plz provide the developer tools link....
Press F12 in your keyboard or right click on any element and click on inspect
Code antha same rasanu elements are not highlighted sir can u please guide
Are you getting any exception or error in the console?
@@HYRTutorials no bro only webpage is opening
Can u record it as a video and send me the video on hyadagirireddytutorials@gmail.com
Thread.sleep ki exception ela through cheyali sir
thread.sleep statement raasina tarvatha daani meeda mouse hover chesthe exception throw cheyyadaniki or try catch add cheyyadaniki option vastadi.
Andulo exception throw chese option pick chesko buddy
@@HYRTutorials thank you
web elements ni ela open chesaru
HTML Dom lo Ctrl+F press cheyyi buddy
Bayya please rply.. Naku webdrivermanager rastunte vati import ravadam ldu... Malli nxt nenu dependency lo webdrivermanager dependency add cheste add kavadam ldu... And nxt nadi eppudu least version eppude nerchukunttunna but dependency add kavadam ledu please rply
WebdriverManger. Chrome driver(). Setup evi em chupinchadam ldu nenu type chestunte so please explain
Pom. Xml lo
Tha error is webdrivermanager cannot be resolved
First check this video
ruclips.net/video/oIhRNl5q3OI/видео.html
If it helps you then you are good.
If not send me the screenshots on hyadagirireddytutorials@gmail.com
K tq bayya
Hi sir, I am also following your videos , but i got this error in program Error: Unable to initialize main class automationtesting.BasicMethod what can i do....please tell me sir.
Send me the screenshot on hyadagirireddytutorials@gmail.com
I'm getting error for the highlight word please resolve
Send me the screenshot on hyadagirireddytutorials@gmail.com
Bro ippudu malli HTML nerchukovalla??
Basics of HTML vachi unte better buddy
Anna naku xpath detailed video kavali.. Link share cheyyara please
Here is the link buddy
ruclips.net/video/ilTFwMV3lHk/видео.html
For any video just check the pinned comment buddy. It has the link for all the playlists
@@HYRTutorials thank you for reply anna
anna, nen code nuv raasinatte type chesa
kani elements highlight avvatledu...🥲🥲
Emanna errors vasthunnaya buddy
@@HYRTutorials ledu, Java version valla kuda ala avutundha
@@perumallamanohar4721 Java version doesnt effect that buddy,
Bro naku highlight avatledhu
Emanna errors vasthunnaya buddy?
How to download function
em download, em function buddy?
Yes i got it facebook mida code chupincharu
Super buddy
Span tag option cheppu anna
Span ante label he buddy
I am looking ur trainning
Currently I'm not providing any training buddy
@@HYRTutorials ok thank u sir me playlist lo unna videos saripothai aa sir to learn selenium with Java
Hi anna locater identify kavatam ledhu anna help me anna
Is that element present inside any frame?
Ardham kaledhu anna
aa element emanna frame lo unda check chei buddy
locators program is ok not running bro
What is the problem buddy
need a postman tool
Konni days ayyaka cheddam buddy
Login and password ante emi evvali sir
Endulo buddy
At 17:19 you got one search box . Could you please explain how did you get that ?
Press Ctrl+F inside the developer tools buddy
References ela import cheyali bro
Manam kavalsina class or interface raasi Ctrl+space press chesthe import cheskodaniki suggestions chupisthundi
Tq
public static void highlight(WebDriver driver, WebElement element) {
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].setAttribute('style', 'background: yellow; border: 2px solid red;');", element);
}
Hi Yadagiri bro,
I can't able to execute the script in this video If I don't add the above line.
If possible Could You Please Explain Why?
Thank you.
Which line you have added here buddy?
naku webdrivermanager.chromedriver.setup() dhaggara error vastundhi
Watch this video buddy:
ruclips.net/video/oIhRNl5q3OI/видео.html
@@HYRTutorials ante na lapi lo webDriverManager ledu ana?
Adi download chesthene kada daanitho work chestam buddy
@@HYRTutorials chesanu andi
Issue ipdu solve indi ha
Are these tutorials enough brother?
Yes buddy
i tried to run the same program but facing below error:Can you please suggest on this:Exception in thread "main" org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of undefined (reading 'setAttribute')
(Session info: chrome=97.0.4692.71)
May be the element that u are looking for is not found and because of that it is trying to perform the operation on undefined.
What is the line you have written?
Sir programme is running but at the end only one element is highlighted not all y sir
May be the element information is modified. are you getting any error in console?
No error sir
Try highlighting the elements individually and check once buddy
Ur not saying detailing
Which part u felt is not good?
I can improve that
@@HYRTutorials selenium part 3 in telugu
@@sushmajadiary8946 ardam avvaledu
@@HYRTutorials meru selenium telugu part 3 lo variables gurinchi clear ga chepaledhu I'm beginner and I don't know how to write html also ur saying int variable it's hard to understand
@@sushmajadiary8946 ohh ok
Mee problem ardam indi kaani nenu java basics ni kooda selenium videos lo chepthe videos chala lengthy avthai.
And inko important thing enti ante selenium nerchukovali annappudu java basics anedi chala important. So evaru ina selenium nerchukovali ante vaallu first java nerchukovali.
So java is a pre requisite for selenium.
Java programming basics teliakunda selenium nerchukunte manam script raastam emo kaani daani meeda manaku 100% understanding undadu.
Hai sir page login ayina tarvatha colour ivatam ledhu
Are you getting any errors?