java - Why I must search explicitly relative elements in Selenium by xpath? -


i'm trying elements xpath selenium's webdriver:

webelement element1 = driver.findelement(by.id("someid")); list<webelement> xpathelements = element1.findelements((by.xpath("//span[@class='someclass']"))); 

with code, i'm getting elements class='someclass' in dom.

only when add "." @ beginning of xpath string elements class='someclass' under element1

element1.findelements((by.xpath(".//span[@class='someclass']"))); 

what's sense here? called findelements element1 default should search elements under element1, why must add "."?

it has got nothing selenium, way xpath works.

if have //elem xpath located anywhere in document. if want search element relative element or rather descendant have use '.' or dot .//elem.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -