I have a problem with this simple code. When the page is loaded I click on the button and a "NO" appears (now there is wikipedia). Then I surf to google and I click the button again and the "NO" is still here. But the logo with ID hplogo is on the page.
If instead of wikipedia I load google first the "YES" appears.
There is no warning or error.
Im a noob on watin and probably i'm missing something simple.
Thx!
namespace watin_TEST_20
{
public partial class Form1 : System.Windows.Forms.Form
{
private IE browser =null;
public Form1()
{
InitializeComponent();
browser = new IE();
browser.GoTo("http://www.wikipedia.it");
}
private void button2_Click(object sender, EventArgs e) //Click when page loaded
{
browser.WaitForComplete();
if (browser.Div(Find.ById("hplogo")).Exists) //There is google logo?
{
textBox1.Text = "YES";
}
else textBox1.Text = "NO"; //always this
}
}
}
Aucun commentaire:
Enregistrer un commentaire