I have a page that has the following line of code
<INPUT border=0 type=image alt="Use a password" name="SUBMIT-password.pss" src="docs/pics/en-us/useapassword_button.jpg">
My code is
using (var browser = new IE(path))
{
browser.Button(Find.ByAlt("Use a password")).Click();
Assert.IsTrue(browser.ContainsText("WatiN"));
}
Instead of browser.Button
, use browser.Image
I setup a test file with your HTML snippet and the following works as you'd expect. If I'm remembering correctly, in WatiN 1.? you'd use Button, but in WatiN 2.1 you use the Image class.
Console.WriteLine(browser.Image(Find.ByAlt("Use a password")).Name);
The above is tested on WatiN 2.1, IE9, Win7.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.