No video

XPath Operators & XPath Functions - and, or, text, contains, starts-with, normalize-space

  Рет қаралды 42,130

H Y R Tutorials

H Y R Tutorials

Күн бұрын

In this video, I have explained XPath operators and XPath functions - and, or, text, contains, starts-with, normalize-space.
XPath (XML Path Language) is a query language for selecting nodes from an XML document.
Or in other words, XPath is a query language for finding elements in an HTML web page.
------ XPath Operators ------
= Tests whether two expressions are equal.
< Tests whether the first expression is less than the second.
<= Tests whether the first expression is less than or equal to the second.
> Tests whether the first expression is greater than the second.
>= Tests whether the first expression is greater than or equal to the second.
!= Tests whether the two expressions are not equal.
and - Tests whether both the first and second expressions are true. If the first expression is false, the second is not evaluated.
or - Tests whether either the first or second expressions are true. If the first expression is true, the second is not evaluated
------ XPath Functions ------
text() - Selects the text nodes of the current context node.
Contains() - Contains method is used when we know about the partial attribute value or partial text associated with the web element.
Starts-with() - starts-with method is used when we know about the initial partial attribute value or initial partial text associated with the web element.
normalize-space() - The normalize-space function ignores the leading, trailing, and repeating white spaces, that means after applying the normalize-space the text become normalized with no line breaks, and give a proper sentence.
------ Examples ------
//td[text()=5000]
//button[@id='refreshBtn' and @value='Refresh']
//button[@id='refreshBtn' or @value='Refresh']
//a[text()='Sign in']
//a[contains(text(),'Sign')]
//button[contains(@class,'sign')]
//div[starts-with(@class,'container')]
//label[normalize-space(text())='First Name']
▶️ Next Video Link: • XPath Axes - ancestor,...
◀️ Previous Video Link: • What is XPath? Types o...
↔️ XPath (XML Path Language) Playlist Link: bit.ly/2RlLdkw
✴ Checkout my other playlists: bit.ly/3gLIAVL
☕ Buy me a coffee: bit.ly/33ljBWc
👑 Join my youtube channel to get access to perks:👇
/ @hyrtutorials
==============================================
==============================================
Connect us @
🔗 Website - www.hyrtutoria...
🔗 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.
#xpath #functions #operators #xpathFunctions #xpathOperators #and #or #text #contains #starts-with #normalize-space #hyrtutorials #webAutomation
how to write xpath using and,selenium interview questions,xpath examples,xpath tutorial,selenium xpath examples,how to write xpath,xpath in selenium
hyr,selenium tutorial,selenium tutorial for beginners,selenium training,selenium testing tutorial,automation testing tools,software testing tools,selenium webdriver training,html controls,selenium webdriver,Absolute XPath,root element,tagname,attribute,attribute value,web automation,selenium xpath,xpath tutorial,dynamic xpath,selenium automation,selenium xpath java,selenium xpath tutorial,dynamic xpath in selenium webdriver,dynamic xpath in selenium using different approaches,xpath contains,xpath text,xpath,xpath tutorial selenium,how to write xpath in selenium webdriver,xpath in selenium,xpath tutorials,relative xpath,selenium dynamic xpath,xpath examples,absolute xpath and relative xpath,xpath expression,xpath in selenium webdriver,xpath tutorial for beginners,webdriver xpath
hyr tutorials,h y r tutorials,xpath functions,xpath functions in selenium,xpath functions in xml,xpath functions example,xpath starts with and ends with,xpath normalize-space,xpath and or,xpath functions tutorial,xpath functions in selenium java,xpath text function,selenium xpath functions,xpath functions with example,types of xpath,xpath starts-with,xpath function,xpath multiple attributes,XPath Operators,XPath Operators & XPath Functions,xpath,webdriver, xpath normalize space
yadagiri reddy, yadagiri reddy h, h yadagiri reddy, h y reddy

Пікірлер: 84
@HYRTutorials
@HYRTutorials 4 жыл бұрын
↔️ XPath (XML Path Language) Playlist Link: bit.ly/2RlLdkw ✴ Checkout my other playlists: bit.ly/3gLIAVL ☕ Buy me a coffee: bit.ly/33ljBWc
@muhammadzia9421
@muhammadzia9421 3 жыл бұрын
great work. both of ur tutorials css selector and this one on xpath are simply the best for the one understanding the basics. keep up the good work. appreciable.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou 😊
@mohdshahrukh5164
@mohdshahrukh5164 2 жыл бұрын
One of the best video on YT regarding XPath,Thnk u sir for making such a amazing vdios
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Thanks buddy 😊
@VaraLakshmiVempatapu
@VaraLakshmiVempatapu 3 жыл бұрын
Your tutorials are very helpful in getting the XPath concepts. Thank you
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou 😊
@minalwalke6128
@minalwalke6128 3 жыл бұрын
Thank you so much sir for explaining imp things related to xpath in such simple manner. 🙏
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thanks and welcome
@vengalaraovucha2299
@vengalaraovucha2299 2 жыл бұрын
nice
@vivekvineet3516
@vivekvineet3516 Жыл бұрын
This is the one I was looking for the best explanations.... Thank you very much
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@Solution4uTx
@Solution4uTx 3 жыл бұрын
I am a beginner and your explanation made it so easy for me.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Great to hear!
@9966056933
@9966056933 3 жыл бұрын
Your explanation is a way better than any others. Thanks and keep making such a good videos.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
So nice of you
@SingaporeChinnodu
@SingaporeChinnodu 3 жыл бұрын
clear and precise. This is what everyone wants.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou
@yuvamani3041
@yuvamani3041 2 жыл бұрын
hereafter, i can't able to forget this concept ... Thanks:)
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Cool. Keep rocking buddy
@nareshgajula
@nareshgajula Жыл бұрын
Very good explanation. Easy to understand. Thank you
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@alabioluwasegun3250
@alabioluwasegun3250 Жыл бұрын
Awesome. Best XPath video ever..
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@kamaleshpramanik7645
@kamaleshpramanik7645 3 жыл бұрын
Thank you very much for clearing many doubts.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Happy to help
@jamadagnithandrangi6715
@jamadagnithandrangi6715 Жыл бұрын
Good Explanation Brother .It's Easy to understand the concepts.
@HYRTutorials
@HYRTutorials Жыл бұрын
Thanks buddy 😊
@pratapadhikari7700
@pratapadhikari7700 3 жыл бұрын
Thanks for the awesome tutorial video.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou, keep watching 😊
@angaraki
@angaraki 4 жыл бұрын
Great coaching!!Thanks,
@HYRTutorials
@HYRTutorials 4 жыл бұрын
Glad you liked it!
@FahimRahman1
@FahimRahman1 3 жыл бұрын
Nice explanation. Thanks.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Thankyou 😊
@mohanramakrishnakonijety9405
@mohanramakrishnakonijety9405 Ай бұрын
Thank you
@tgrakesh8gmail
@tgrakesh8gmail 4 жыл бұрын
Good and clear explanation👌...it will be good if u make videos on CSS selectors also..thanks.👍
@HYRTutorials
@HYRTutorials 4 жыл бұрын
Yeah sure
@HYRTutorials
@HYRTutorials 3 жыл бұрын
CSS Selectors videos playlist:👇 🔗 bit.ly/2Rn0IbD
@slakshmiics
@slakshmiics 2 жыл бұрын
Thank you so much for sharing this
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Welcome buddy 😊
@thetruth5672
@thetruth5672 3 ай бұрын
Thanks sir
@nandinirayavarapu1917
@nandinirayavarapu1917 2 жыл бұрын
Sir is it correct that while using only contains method we need not to give text()? But for starts-with(), normalize-space() methods we must use text()?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Text function can be used with all those functions
@nandinirayavarapu1917
@nandinirayavarapu1917 2 жыл бұрын
Ok tq sir my doubt was cleared
@gbmohankumar9584
@gbmohankumar9584 3 жыл бұрын
How to handle customized drop down ? Can you upload one video on that please
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Watch this video: kzbin.info/www/bejne/oHO5pZ99ibSKq5I
@swapnabhaskaruni
@swapnabhaskaruni 2 жыл бұрын
when we use a attribute with normalize-space( ) do we still use @ like //tag[ normalize-space(@attribute)='value')
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Not required for text but for any other attribute it is required
@joshibhushan1
@joshibhushan1 2 жыл бұрын
One query here is, when you have used //td[text()=5000] , you have not applied any ' or ' ' or " " for the text and still getting the correct value , how is this happening ? I tried to do it this on the Amazon site for highlighting the products which have price more than 30000 but this is not working(of course xpath pattern was different) but if you can shed some light on that then it would be helpful
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Yeah sure, send me the details and screenshots on hyadagirireddytutorials@gmail.com
@floraartworks
@floraartworks 2 жыл бұрын
Sir , how to use sum operator in xpath to sum two consecutive td of a tr? Please give syntax
@HYRTutorials
@HYRTutorials 2 жыл бұрын
I dont think we can do that using xpath
@floraartworks
@floraartworks 2 жыл бұрын
@@HYRTutorials sir in this case how to do that? Actually I am scraping website data into Excel using selenium, but don't want to use the Excel's ability to do the sum. Is there any way to sum two td of a tr during webscraping using selenium?
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Never tried that buddy
@testtesting1137
@testtesting1137 3 жыл бұрын
Thank you sir very helpful. Sir, today i got to know about a smart editor SelectorsHub for xpath, you might like to try that sir. I found that very helpful in learning and time saving with error message feature and attribute suggestion.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
That's good. But without having proper knowledge on xpath, one should not start using any add-on. Add-on saves your time but there are lot many cases in which you can't use the add-on. So it is always advisable to learn about xpath first, then for reducing the time in writing xpath you can use the add-on.
@testtesting1137
@testtesting1137 3 жыл бұрын
@@HYRTutorials Agreed without having proper knowledge we should not use any tool not just xpath tool but i always found people say this blindly just for xpath tool. While on the other hand we are always using an xpath tool that is devtools
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Yes, we are already using the dev tools. Dev tools can be used in two ways 1. Write your own xpath and check whether it is working or not 2. Copy the auto generated xpath provided by dev tools. I encourage using option 1. Option 2 is again like a add-on kind of tool only.
@testtesting1137
@testtesting1137 3 жыл бұрын
@@HYRTutorials i started using this tool SelectorsHub as Naveenautomationlabs recommends that. For option1 which you said, devtools doesn't tell whats wrong in my xpath, devtools doesn't support shadow dom, have to copy attribute values and have to inspect element again and again. Devtools also match as string because of which it gives wrong results. These all things has been taken care in this tool. I would recommend everyone for this tool. We should not alwys follow old things blindly when there is something innovative. I believe initially people would have not accepted selenium also but now everyone is using it.
@HYRTutorials
@HYRTutorials 3 жыл бұрын
It looks like a promotion of some particular tool. If you read my comment clearly, you will get the point what I'm trying to convey. I'm not against or favourable to any tool. I'm just saying we should always learn about xpath, then only we should move on to using these add-ons or tools.
@vidyatilak
@vidyatilak 3 жыл бұрын
hi could you plz post , how to write xpath ,if text is not included in any tag. "Service type"
@HYRTutorials
@HYRTutorials 3 жыл бұрын
Try any of the following XPath: //div/following-sibling::text() //div/following-sibling::text()[. = "Service type"] //div[@class='mat-list']/following-sibling::text() //div[@class='mat-list']/following-sibling::text()[. = "Service type"]
@judseenaannie5670
@judseenaannie5670 3 жыл бұрын
Sir I want all the front page titles as one x path
@HYRTutorials
@HYRTutorials 3 жыл бұрын
I guess that is not possible. If you want to get the title then u need to lang in that page then only you can get the title. So if we want all the titles then we need to navigate to each and evey page then get the title.
@poojasardaana1570
@poojasardaana1570 3 жыл бұрын
How can I use Suffix with Text()?
@HYRTutorials
@HYRTutorials 3 жыл бұрын
U mean starting text or partial text?
@sykesybwoy
@sykesybwoy 3 жыл бұрын
Hey, nice vid... Is it possible to find a variable child element of an element found with a relative xpath? i.e. th[text()='xxxx'] give the the text of it's td?
@HYRTutorials
@HYRTutorials 3 жыл бұрын
The question is bit confusing, can you ask it clearly?
@sykesybwoy
@sykesybwoy 3 жыл бұрын
@@HYRTutorials I thought the question was pretty clear, it’s fine I’ve found the answer now. //th[text()=‘xxxx’]/following::td[1]
@HYRTutorials
@HYRTutorials 3 жыл бұрын
@@sykesybwoy ohh cool
@RamaKrishna-or2cj
@RamaKrishna-or2cj Жыл бұрын
Can you explain xpath using last() sir??
@HYRTutorials
@HYRTutorials Жыл бұрын
You can watch this video buddy kzbin.info/www/bejne/n523d6qDi5iffs0
@RamaKrishna-or2cj
@RamaKrishna-or2cj Жыл бұрын
Tqu👍
@dinokundukulam5689
@dinokundukulam5689 3 жыл бұрын
I am not able to access the official page H Y R tutorials ???
@HYRTutorials
@HYRTutorials 3 жыл бұрын
I just checked and it's working.
@dinokundukulam5689
@dinokundukulam5689 3 жыл бұрын
@@HYRTutorials yeah now it's working . Actually I have an interview of amazon for automation analyst and they require xpath so this is enough to crack the interview or still there are other topics on xpath , I am a beginner , plz help me
@HYRTutorials
@HYRTutorials 3 жыл бұрын
@@dinokundukulam5689 did u checkout my xpath playlist? If so these are enough.
@dinokundukulam5689
@dinokundukulam5689 3 жыл бұрын
@@HYRTutorials Yes I have watched the 4 videos in the playlist
@HYRTutorials
@HYRTutorials 3 жыл бұрын
@@dinokundukulam5689 Then it's enough.
@satyanarayanas6769
@satyanarayanas6769 2 жыл бұрын
slow voice when listening
@HYRTutorials
@HYRTutorials 2 жыл бұрын
Slow or low?
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 3,3 МЛН
🩷🩵VS👿
00:38
ISSEI / いっせい
Рет қаралды 21 МЛН
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 18 МЛН
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 43 МЛН
XPath Tutorial (and How to Use them for Web Scraping)
36:01
François from Octoparse
Рет қаралды 4,3 М.
Xpath Locator in Selenium | Most Easy to understand for Beginners | Part 3
1:25:13
XSLT XPath Tutorial
1:08:20
arbitrarytechnology
Рет қаралды 45 М.
How to handle Calendars using Selenium WebDriver | Selenium |
1:03:35
H Y R Tutorials
Рет қаралды 36 М.
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 3,3 МЛН