albecsi>
abe
aubcecsis
eliplavag/8>
eLippythone/ >
Lipubye/>
<>
esse Henth-chila(n)
ebElenent cssele = driven. Find lenents(8y.cssSelector(“1i:ath-child(n)"));
Here ifwe can see the ul fi parent child structure, We have only tag names which are common to everyone, Here if we want to locate sat Java we will put
in above commans
Inner text
This ie ight now not supported by WebDriver in case of CSS, but most probably will support in upcoming Selenium 3.0r 4
Syntax eas tag:containa( inner text), Hrs in syntax can use any combination discussed above, With that we neac!ta use () containe(nne® text
Example
case spanzcontains (‘Upload you pic *)
WebElenent cssele = driver. Findélenents (By .cssSelector("span:contains( ‘Upload you pic*)"));
Absolute and Relative Path
The Examples we have seen bl now ate related to only single tag and its atnbute, But whan we cequie to build path using parent child relation we need fo
sive ther absolute or relative path
abc
abe
elbbpythone/>
eu
Consider here we want to locate Python using parent child relation. In that case relative path willbe
Relative path: r=-divul’space> linth-cniel2) or cee~cli-espace>linty-chile(), ln sesond combination ws have removed ul Space denotes its 8
Relative path, Here WetDriver will search 3 inside given div and ul
‘And if we want Absolute path for same it will be
Absolute path: s5= div>ul limth-child3) or ess=ul> linth-child(), Here angular bracket denotes Absolute path. Its an exact path for given element,
Ta erow the dierence between both ats consider the example,
Someone asked you where is your office? Most comman answers Hinlewadi. But it courier boy asked! you the address you will tl fll and exact address of
your office. one is relative path to your office but 2"is absolute one.