i am using selenium ide for testing my .net website. i am testing login for the website by using selenium. i recorded the steps and as i am testing the code in visual studio the test case is failing. my test case is:
selenium.Open("//login.aspx");
selenium.Type("fldUsername", "abc");
selenium.Type("fldPassword", "abc");
selenium.Click("btnLogin");
bool log1 = selenium.IsPromptPresent();
Assert.IsNull(log1);
开发者_开发技巧 selenium.WaitForPageToLoad("80000");
here username and password are incorrect and is giving a alert. but using selenium it is not getting that alert. please someone help me out..
Probably should have been migrated to sqa.stackexchange.com, but, either way.
Is there any reason why you're creating log1. It would be much for efficient to do something like: Assert.isFalse(selenium.IsPromptPresent());
I don't use Selenium 1 much, however, after a quick test, this seems to work.
Assert.IsTrue(Regex.IsMatch(selenium.GetAlert(), "regex to match"));
As for the regex matching, if you're going to make sure that the prompt is there, you might as well make certain that it's the correct prompt.
精彩评论