I intend to display the value of value attribute from the Google Translate menu of all the languages. It is represented by the left list of the page.
This is the code I am running and nothing is displayed on the console (apart from the new lines). What could be wrong?
using System;
using WatiN.Core;
namespace Test
{
class Program
{
[STAThread]
static void Main(string[] args)
{
IE ie = new IE("https://translate.google.com/");
Div selectLanguage = ie.Div(Find.ById("gt-sl-sugg"));
foreach (var lang in selectLanguage.ChildrenOfType<Div>())
Console.WriteLine(lang.GetAttributeValue("value"));
ie.Close();
Console.Read();
}
}
}
WatiN: 2.1.0
Replace ("value")
with ("Value")
, For some reason all the attributes have the first letter capitalized. My guess is watin deserializes the DOM elements into objects, and since it is pretty standard to have property names with that naming convention (PascalCase), it does it that way for these objects too.