Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

xpath question

$
0
0

I can get the webpage with HttpWebRequest now i am trying to write corret xpath code for this 

there is 81 options but i copy poste 8 of them i am trying to get all of them

here is my code

for (int i = 1; i < 82; i++)
                    {
                        ab = htmlDocument.DocumentNode.SelectSingleNode("//select[@name='gradovi']/option[" + i.ToString() + "]").InnerText.Trim();
                        MessageBox.Show(ab);
                        cities.Items.Add(ab);

                    }
but it gets me nothing i mean empty what ever 

here is html

<select name="gradovi" onchange='this.form.submit()'><option value="1">Banovići</option><option value="2">Banja Luka</option><option value="3">Bihać</option><option value="4">Bijeljina</option><option value="5">Bileća</option><option value="6">Bos.Brod</option><option value="7">Bos.Dubica</option><option value="8">Bos.Gradiška</option>

any help? thank you

best regards cihad yıldız

code that i want to need xpath code

Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>