jeudi 27 octobre 2016

how to select by text using selenium and c#

I need to select the value (hours) related to an specific date. For example in the html below I need to read the number 24:20 based on the number 6; this is the html:

<div class="day-ofmonth">
<div class="day-ofmonth">
<span class="day-num">6</span>
<span class="available-time">24:20</span>
</div>
<div class="day-ofmonth">
<span class="day-num">7</span>
<span class="available-time">133:50</span>
</div>
<div class="day-ofmonth">
<div class="day-ofmonth">

if I use:

IWebElement t_value = d.FindElement(By.XPath(".//*     [@id='calinfo']/div[9]/span[2]"));
var t_again2 = t_value.GetAttribute("textContent");

i will get 24:20; but i need to get the value 24:20(in this case) based on number 6 (6 refers to day of the month) and not the Xpath (everyday will be a different date). If anyone can point me in the right direction, Thanks

Aucun commentaire:

Enregistrer un commentaire