Тёмный

How to become genius in CSS Selector in Selenium || Create Custom Dynamic CSS Selectors 

Naveen AutomationLabs
Подписаться 389 тыс.
Просмотров 118 тыс.
50% 1

In this videos, I have explained how to create custom - dynamic CSS selectors in Selenium WebDriver.
CSS selector is always faster than Xpath, so it's important to learn to create your own CSS Selectors.
~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
www.youtube.co...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/...
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautom...
API Course: www.naveenautom... ➡️Get Our Courses✔️
📗 Get My Paid Courses at
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautom...
API Course: www.naveenautom...
-------------------------------
✔️SOCIAL NETWORKS
Facebook: / naveenqtpexpert
Twitter: / naveenkhunteta
Blog: www.naveenautom...
--------------------------------
Support My Channel✔️Or Buy Me A Coffee
Paypal: paypal.me/nave...
Google Pay: naveenanimation20@gmail.com
--------------------------------
✔️Thanks for watching!
देखने के लिए धन्यवाद
Благодаря за гледането
感谢您观看
Merci d'avoir regardé
Grazie per la visione
Gracias por ver
شكرا للمشاهدة

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 175   
@naveenautomationlabs
@naveenautomationlabs 4 года назад
here is the list of all CSS locators discussed in video: Custom CSS 1. id--> htmltag#id , #id 2. class --> htmltag.classname, .classname, .c1.c2.c3, htmltag.c1.c2.c3...cn 3. parent>childtag ul#categories #username input#username input.form-control.private-form__control.login-email input#username.form-control.private-form__control.login-email input.login-email .form-control.private-form__control.login-email 4. htmltag[id='value'] //div[@id='test'] input[id='username'] -- css with one attribute //input[@id='username'] --xpath input[id='username'][type='email'] -- css with two attributes //input[@id='username' and @type='email'] -- xpath 5. contains the text in css: input[id*='user'] input[id*='name'] id = test_123 test_345 test_456 input[id*=test_] 6. starting the text in css: input[id^='user'] 7. ending the text in css: input[id$='name'] 8. comma in css: div.private-form__input-wrapper, input#username 9. first-of-type in css: ul#categories>li:first-of-type 10. last-of-type in css: ul#categories>li:last-of-type 11. nth-of-type ul#categories>li:nth-of-type(1) ul#categories>li:nth-of-type(14) ul#categories>li:nth-of-type(3) ul#categories>li:nth-of-type(n) -- all 12. sibling of element: div.private-form__input-wrapper + div div.private-form__input-wrapper+div.private-form__meta ul#categories>li:nth-of-type(3)+li 13. not operator in css: input.form-control.private-form__control:not(.login-password)
@balajibabu6286
@balajibabu6286 4 года назад
Thanks a lot Naveen
@Imran-M-
@Imran-M- 4 года назад
Hi Naveen, is it possible to validate the locator(xpath, css) in edge browser as well in the same way we did in chrome? If yes, how to do it? Please let me know
@mudaseer21
@mudaseer21 4 года назад
Best of India
@avanthichelimilla4981
@avanthichelimilla4981 4 года назад
Hi Naveen, If there is only text present then how to write CSS for that.
@mudaseer21
@mudaseer21 4 года назад
@@avanthichelimilla4981 doesn't support text
@rajputyuvraj6558
@rajputyuvraj6558 4 года назад
I must say, You are a great Contributor to QA community. You are giving back to community what every legends do. Pls keep sharing stuffs like this.
@FitnessMyLife
@FitnessMyLife 4 года назад
Very well documented. Previously I was just copying the Css Selectors from the browser and editing, now I know how I can write my own and of course in different ways. Simply Perfect. :)
@naveenautomationlabs
@naveenautomationlabs 4 года назад
Thank you Shreya
@swatiagrawal1489
@swatiagrawal1489 2 года назад
Always wanted to know more about css selector and finally have gained so much after watching this video..... Thank you Naveen 😀😊
@ashwina.k5602
@ashwina.k5602 2 года назад
You have made tutorials on literally every topic I can think of, mad respect for you!❤
@Swarno2004
@Swarno2004 4 года назад
You make it so simple that after watching your video feel very confident
@mansigaikwad8520
@mansigaikwad8520 3 года назад
Hi Naveen Sir. Am a trainer too but I would definitely say that if am doing well in my career then the half of the credit goes to you Sir. Dnt stop being awesome....
@rajsona2804
@rajsona2804 Год назад
Thank you so much Naveen i am following your classes from last 3 years the way your explanation is really really superb thank you 🎉
@devendrapratapsingh9931
@devendrapratapsingh9931 4 года назад
Hi navin sir, you r a gem. I am continuously following your videos. How much dedications you have to explain these concepts in so better way. Really hats off to you Sir
@wagalprasad1869
@wagalprasad1869 11 месяцев назад
It is an Amazing that I never seen before the perfect way like this to write css and X path
@SarangHoley
@SarangHoley 4 года назад
Most detailed video on this topic on RU-vid 👍😊
@nanistar2400
@nanistar2400 4 года назад
Hi Naveen...You are the best..I started my career by seeing your RU-vid blog...
@vidhivinchhi1027
@vidhivinchhi1027 6 месяцев назад
Great Job Naveen! I can't thank you enough.
@debjanighosh5947
@debjanighosh5947 2 года назад
Thank you so much. You save my life through this video.
@uvitalkumar
@uvitalkumar 4 года назад
Intact, I'm waiting for this video. I never see this kind of explanation. Thank you Naveen.
@gayathrivr
@gayathrivr 4 года назад
Your tutorials are helping me a lot in real time testing. Thank you so much sir.
@santoshrandive
@santoshrandive 4 года назад
You made CSS Selector very simple...wow
@littonsinha2959
@littonsinha2959 4 года назад
This video on CSS has been the best I have ever come across. Thanks Naveen. Hope to reach 100k subscribers soon.
@JP-xb1fo
@JP-xb1fo 4 года назад
Very well Explained. I was able to understand both X path and CSS from your videos. Thanks a ton Naveen.
@swamyas5668
@swamyas5668 4 года назад
Crystal clear explanation with examples ..Thank you Naveen
@adisatapathy
@adisatapathy 3 года назад
Waoo I have never seen css explanation like this before ❤️
@CrorepatiRahul
@CrorepatiRahul 2 года назад
I wanted to Give you National Award for Explanation of CssSelector 👌👌👌👌👌👌
@naveenautomationlabs
@naveenautomationlabs 2 года назад
Haha thank you for the award
@NaciTurgut
@NaciTurgut 2 года назад
Great video on CSS Selectors. Thanks for this video.
@GaneshJadhav-ne7ou
@GaneshJadhav-ne7ou 3 года назад
As they say when youtuber explains not a single bit go waste. Thanks Naveen for this video.
@madirajuchaitanya
@madirajuchaitanya 4 года назад
Well Explained. Thanks Naveen Sir...for this wonderful tutorials. Like you said, I didn't find any of these in other video tutorials...as Yet...!!
@herokrout6395
@herokrout6395 4 года назад
Excellent Naveen sir..i learned lot of things from your video
@tricktictrip2192
@tricktictrip2192 2 года назад
Great video, exactly what I was looking for. for those who come later the point 3 is shown in the point 9
@greywolf187
@greywolf187 3 года назад
Thanks man, im doing a coding project for an interview and this is very helpful
@ChiragPatel-lk1vl
@ChiragPatel-lk1vl 4 года назад
Wow brilliant efforts Naveen, glad to see your videos after long time, please make videos regularly if possible Thanks
@amolnawale2177
@amolnawale2177 4 года назад
Thanks Naveen for this video on css selectors. Now that i can equally have css selectors also along with the xpaths in my framework.
@atulsamant898
@atulsamant898 3 года назад
Nice lecture, everything about css you will find here
@antarabanerjee7314
@antarabanerjee7314 Год назад
extremely useful Naveen!
@jatindersinghjp
@jatindersinghjp 3 года назад
Thank you Naveen...that's a perfect explanation of CSS selectors
@yikeberayana554
@yikeberayana554 Год назад
you are great man, just thank you for sharing us such interesting topic
@mounikakaki7158
@mounikakaki7158 4 года назад
u are the god of automation Naveen.
@naveenautomationlabs
@naveenautomationlabs 4 года назад
Thanks for watching mounika
@gautam3945
@gautam3945 8 месяцев назад
Thank you sir... Great explaination
@daisyd4172
@daisyd4172 2 года назад
Its Great video! ✔ ~15minits and I aware watching in 2x spead🏁
@kalpanaperiasamy671
@kalpanaperiasamy671 2 года назад
such a valuable video.thank yu so much
@SanjeevKumar-qd1xo
@SanjeevKumar-qd1xo 3 года назад
Thanks for super Explanation on CSS
@rkaravind
@rkaravind 4 года назад
Hi Naveen, this is really amazing information. Thanks
@JitendraKumar-lr3vq
@JitendraKumar-lr3vq 4 года назад
very well explained thanks naveen for the demonstration..observed one thing element identified through css selector is fast than element identification through xpath ..
@preethishetty7161
@preethishetty7161 4 года назад
It’s absolutely super clear👌
@sanghamitrabhowmicklive3013
@sanghamitrabhowmicklive3013 2 года назад
Such amazing explanation!!! 👏
@nareshreddy69
@nareshreddy69 4 года назад
Thanks Naveen for video, Waiting for this video since long.... :)
@Iamtrk1993
@Iamtrk1993 4 года назад
Naveen:-Symbol of Excellence
@huzeyfesutcu4045
@huzeyfesutcu4045 3 года назад
Very clear and helpful Thank you.
@ashishmishra7214
@ashishmishra7214 4 года назад
Very good explanation👍
@nayanamr2447
@nayanamr2447 4 года назад
Thank You So much Naveen:) It's really a very helpful video!!!
@ankit6613
@ankit6613 4 года назад
Thank you @Naveen, It's really Helpful Is there any way to select 'Inner Text' using CSS Selector ?
@EchoeyCares
@EchoeyCares 4 года назад
Custom CSS CSS SELECTORS 1. Id → htmltag#id 2. Class → htmltag.classname, .classname ] is also correct , .c1.c2.c3 ]in case of cascading, htmltag.c1.c2.c3…..cn 3. parent>childtag 4. Can remove htmltag in case id or class name is unique Selecting a tag Therefore ul#categories>li#first.list>a 5. Need to remove spaces and replace it with ‘.’ Therefore, input.pro-12.max-34r.Global 6. htmltag[id=’value’] is also correct, no need to write // for css selectors htmltag[id=’value’] → css with one attribute htmltag[id=’value’][type=’email’] → css with two attributes //htmltag[id=’value’ and type=’email’] → xpath with two attributes 7. Contains the text in CSS Contains function was present in css0 but was removed from css3 input[id*=’user’] or input[id*=’name’] 8. Starting the text in CSS input[id^=’user’] or input[id^=’u’] 9. Ending the text in CSS input[id$=’name’] or input[id*$’e’] 10. Selecting first of its type and last of its type ul#categories>li:first-of-type ul#categories>li:last-of-type nth-of-type ul#categories>li:nth-of-type(1) ul#categories>li:nth-of-type(n) → all elements 10. Sibling category div.wrapper-form+div#whole-form
@vaibhavgupta973
@vaibhavgupta973 2 года назад
thanks Naveen !
@malanchakalsa7926
@malanchakalsa7926 4 года назад
This video is very valuable, Naveen. Thank you soo much :)
@boobalakrishnan89
@boobalakrishnan89 4 года назад
Thanks#Naveen.You.are.the.best!
@itshamiiid
@itshamiiid 2 года назад
great video. very helpful. thanks
@Depthsreflection
@Depthsreflection 2 года назад
Thank you for this video.
@mallikarjunaarjun6892
@mallikarjunaarjun6892 4 года назад
Hi Naveen , nice video and it is more useful I have one question in css selectors how to navigate from child to parent ??
@prakashn3539
@prakashn3539 4 года назад
You cannot back traverse from child to parent in CSS and that is the big difference between xpath and CSS
@doguparthiabhilash4937
@doguparthiabhilash4937 2 года назад
Hi Naveen, Thanks for the detailed explanation :) I have a 2 doubts > in contains: you said if we have any attribute in above example then how to use contains but in a html tag if there are no attributes and only text is available then how to identify it using css. (Ex: In Xpath, we use //div[contains(text(),'New Owner')]) > how to go to immediate element from current element using CSS (Ex: In Xpath, we can use "/.." to move to immediate parent ) Can you help me on this Thanks in Advance
@balkrishnayadav6942
@balkrishnayadav6942 4 года назад
Really very helpful video!!! Awesome Naveen..!! Not able to find the document in the comment section. Pls provide
@udayptp
@udayptp Год назад
Great information sir what if we want to write css selector based on text. For ex: span span I want to write css selector that includes that text. Like span[text] what if span doesn't have any attributes like class, I'd it only contains text. And that text is dynamic
@DipakDas-tm3nu
@DipakDas-tm3nu 4 года назад
Thanks Naveen .
@prashanthreddyburri
@prashanthreddyburri 4 года назад
thank you for sharing the knowledge...
@MaheshBabu1989
@MaheshBabu1989 2 года назад
Very nice video.. Thanks Naveen.. Quick question.. When do we use sibling locater in real time
@rohitprakash8120
@rohitprakash8120 4 года назад
Thanks for sharing this video Naveen. Could you please help me here? I am looking for writing CSS by using parent, following, preceding like we do in xpath. Ex: xpath is "//span[contains(text(),'Close')]/parent::button". How can we write css for this xpath?
@KanishaKutty30
@KanishaKutty30 5 месяцев назад
Any solution?
@kumarsaheb
@kumarsaheb 3 года назад
Sir , thanks a ton !!! True blessing to society. I would like to help with some contribution. How can I do it ?
@diptajitp
@diptajitp 4 года назад
Awesome video...knowledge packed.
@MrMPatra
@MrMPatra 4 года назад
Thanks Naveen:)
@akhildhat2279
@akhildhat2279 4 года назад
Hi naveen, how to handle text in css. In xpath we have text function but in css do we have any?
@tallurivamsi6413
@tallurivamsi6413 3 года назад
Hi Naveen, I have same div class for 3 times ,for them parent and super parent all are same, but text only differs. For example: select1 select2 select3 Here for all the div’s parents have the same name. How can I get the text of select1 or select2? Tried with .sample(contains:”select1”),when I try with “.sample” 3 occurrences,used nth-of-type(1)but its selecting all select1,2,3. How can I get the text?
@real_hello_kitty
@real_hello_kitty 3 года назад
Thanks! You are genius. 😃
@ShabhashBabu
@ShabhashBabu 4 года назад
Hi Naveen can u update. blazemeter URL in video description which will be helpful
@vidhyanaphade1818
@vidhyanaphade1818 4 года назад
very well video & i just want to know that 3dr parent>child & sibling of element in cs are same?
@sairatanpatra
@sairatanpatra 4 года назад
Thanxxx a lot sir😊
@AbhijeetSinghs
@AbhijeetSinghs 3 года назад
How to know the css selector for the next page on a website for pagination. Iam using windows power automate for web data extractions
@SaifulIslam-sn2ys
@SaifulIslam-sn2ys 4 года назад
Hi Thanks for nice example. How to use, if ul is not having any class or id? Just simple
@chillamcharlabharath9730
@chillamcharlabharath9730 4 года назад
Thanks a lot naveen😍😍
@MS-kn7dh
@MS-kn7dh 2 года назад
Hi Naveen...how can we write css if only text is unique ,such as: text
@bharathkoneru4008
@bharathkoneru4008 3 года назад
Hi Naveen, Thanks aton for the amazing custom CSS selector types. In CSS, is there any reverse engineering to go the preceding sibling? This would be really helpful when we want to click on a check box of a particular record in a dynamic table based on the text
@naveenautomationlabs
@naveenautomationlabs 3 года назад
In CSS, there is no backward traversing.
@chakshaysaini3343
@chakshaysaini3343 4 месяца назад
Hi Naveen, how to get the text in Css Like in Xpath we use ( //span[text()='Username']
@techupdates9166
@techupdates9166 3 года назад
We have only one classname and that is not unique one so in this scenario how we can select that, Naveen?
@sudeepbasak1116
@sudeepbasak1116 4 года назад
Hi Naveen, Thanks for nice video. I have a question, CSS selector is static or not ?
@wagalprasad1869
@wagalprasad1869 11 месяцев назад
Can you please upload the video for specflow bdd, csharp , page object ,data driven and api with cd cid video
@livingleaving2370
@livingleaving2370 4 года назад
hi, I want to select "Admin" (css selector only cos i'm using cypress) but i have nothing in front of Admin? what should I do? Admin fyi, this is one of the items from drop down list. thanks a lot
@shaikinthiyaz6378
@shaikinthiyaz6378 3 года назад
Hi Naveen. Is it possible to locate element with text in css selector?
@naveenautomationlabs
@naveenautomationlabs 3 года назад
Not possible
@NKBL100
@NKBL100 4 года назад
Hi Naveen, it is really a very good video I was waiting for video on CSS since long. Thanks a lot. Could you please also add the content of this video in description.
@littonsinha2959
@littonsinha2959 4 года назад
One thing which I was unable to locate using CSS was text in BlazeMeter site like " The Continuous Testing Journey"
@shubhammane6867
@shubhammane6867 3 года назад
que : if we are getting the address as 1of 4 on a page for getting the text, and adress of both are also same in such case what can be done in case of css selector?
@danieljoel7845
@danieljoel7845 4 года назад
Can we give text in nth-of-type to match text and then click on element?
@lannguyen7460
@lannguyen7460 3 года назад
thanks, I know more ways to get Css locators
@jirorounin8091
@jirorounin8091 2 года назад
Naveen can we execute css selector directly from a reference element? For example I have find element1. Then I will do element1.FindElement(By.CssSelector("some expression")); Something like this so the css expression will only be run from the reference element?
@vijayppatel
@vijayppatel Год назад
you nee to use FindElements for first element1 then loop into to get attribute you are looking for
@nikhithakrishnam5388
@nikhithakrishnam5388 Год назад
Hi bro pls tell me how to open chrome browser using selenium in visual studio code ?
@omerozdemir9746
@omerozdemir9746 4 года назад
Thank you for this great video :)
@shreekrishnapriyaj_myscribbles
@shreekrishnapriyaj_myscribbles 2 года назад
Better than XPath video
@mounikachowdarynekkanti7760
@mounikachowdarynekkanti7760 4 года назад
1) For following sibling u were used + symbol but what we can use for preceding sibling 2)how to get parent tag by using css selector
@ravishchoudhary2900
@ravishchoudhary2900 4 года назад
Hi Naveen, Thanks for the video. Is there any function similar to text() as in xapth same for css
@VineetKumar-eb3lv
@VineetKumar-eb3lv 4 года назад
Hi Naveen, Could you please create video on writing xpath for shadow dom
@naveenautomationlabs
@naveenautomationlabs 4 года назад
Sure, ill try to do the same.
@VineetKumar-eb3lv
@VineetKumar-eb3lv 4 года назад
@@naveenautomationlabs thank you
@uvitalkumar
@uvitalkumar 4 года назад
Naveen, can you make a video on graphs and charts. I'm bit confusing while writing xpaths using SVG's.
@enochabishek4984
@enochabishek4984 Год назад
thanks for your coaching bro
@gauravbhatt6258
@gauravbhatt6258 4 года назад
Hi @Naveen can you please let us know how to usee CSS Selector for webtable ?
@upendradokala4653
@upendradokala4653 2 года назад
TQ bro
@vijayaraghavanvashudevan1977
@vijayaraghavanvashudevan1977 4 года назад
Thank you so much 👍
@anupampandey560
@anupampandey560 3 года назад
//span[contains(text(),''Sample")] what will be it's css
Далее
How to Become Genius in XPath in Selenium  - Session -18
39:48
How to select CSS Selectors (for automation testing)
18:28
Run Selenium Test Cases Using Pipeline Job
18:49
Просмотров 14 тыс.