find by xpath only in child of element with c# selenium -


i have code :

readonlycollection<iwebelement> questions = driver.findelements(by.xpath("//fieldset[@data-seleniumrp='question']")); foreach (iwebelement question in questions) {     readonlycollection<iwebelement> repdispo = question.findelements(by.xpath("//input[@data-selenium-positionquestion]")); } 

my collection "questions" have 11 elements, right ! each "question" normaly have 4 elements ... code , have 44 results ( elements in page ) in "repdispo" ...

how childrend element , not element ?

i suspect problem in xpath inside foreach loop. need add . @ beginning of // axis make relative current question element :

".//input[@data-selenium-positionquestion]" 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -