This will be one complete tutorial that will cover Everything in XPaths.
Demo page 1 : https://theautomationzone.blogspot.co...
Demo page 2 : https://theautomationzone.blogspot.co...
Topics are as follows :
Into :(0:00)
Basics :(1:36)
Using OR & AND :(8:12)
innerText or text function :(11:20)
Parent / Child is Unique :(12:53)
Xpath with Index :(18:10)
Absolute vs Relative :(21:07)
Advance - Elements as an Attribute (23:02)
Part 2 & Part 3 :- XPath Functions
Contains :(25:52)
Starts-With :(29:17)
Position :(30:42)
Last :(32:34)
Count :(34:13)
Ignore Space - normalize-space :(36:35)
Ignore Case - translate (41:00)
Ignore Space + Ignore Case :(46:00)
String-Length :(49:00)
Floor and Round :(50:30)
Not :(53:05)
substring-before | Substring-after :(55:20)
Part 4 : AXES
AXES intro :(58:34)
parent :(1:00:37)
ancestor and ancestor-or-self :(1:02:36)
child and descendant :(1:05:32)
following and following-sibling :(1:08:28)
preceding and preceding-sibling - same and above
Example :(1:12:25)
XPath Basic : • Xpaths in Selenium | Xpath Locators |...
XPath Functions Part 1 : • Advance Xpaths | Xpath Contains, Posi...
Xpath Functions Part 2 : • Advance Xpath | Ignore Case and Space...
XPath Axes : • Xpaths Axes | Advance Xpaths - Xpath ...
Code Snippet :
Xpath in Selenium
===================
//*[@id='value'] - Any Elements by id
//*[@name='value']- Any Elements by name
//*[text()='value']- any Elements by text
//input[@id='value']- input Elements by id
//div[text()='value']- input Elements by text
//input[@id='value' and @name='value'] - two or more attributes
//input[@id='value' or @name='value'] - two or more attributes
//div[@id='value']/.. - one element up
//div[@id='value']/input - one element down by tag
//div[@id='value']/div/input - two element down by tag
//div[@id='value']//input - any level inside the element
//div[@id='value']//input[1] - first element inside an element wit tag
//div[@id='value']//input[@id='value'] - element inside an element with tag and attribute
Elements as attributes
//div[@id='value']/..
//*[div[@id='value']]
//div[@id='value']/../..
//*[*[div[@id='value']]]
Xpath Contains and Positions and more
============================
contains()
starts-with()
last() - tables
position() - use checkboxes in tables
count() - tables is an example
Xpath Ignore Case and Whitespaces and more
============================
normalize-space() - example with spaces
translate() - replace example
not() - take any example
floor()
round()
string-length(string)
substring-before(string1, string2)
substring-after(string1, string2)
Xpath Axes
===========
ancestor
ancestor-or-self
attribute
child
descendant
descendant-or-self
following
following-sibling
parent
preceding
preceding-sibling
self
Смотрите видео Complete Xpath from Basic to Advance | 14 Xpath Function | All Xpath AXES | Xpath tutorial онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Automation Zone 18 Июль 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 102,525 раз и оно понравилось 2.3 тысяч людям.