My project is in mvc and I want to test it using selenium web driver. Some button clicks work properly. But when I navigate to different page saying continue on that page Save button doesn't work.
Below is my code
driver.FindElement(By.Id("BtnAddNew")).Click();
IWebElement cat = driver.FindElement(By.Id("Cat"));
cat.SendKeys("Single-family house");
IWebElement ext_id = driver.FindElement(By.Id("ExternalId"));
ext_id.SendKeys("SAR_47");
IWebElement zip = driver.FindElement(By.Id("AddressZipTown"));
zip.SendKeys("1205 Genève");
IWebElement street = driver.FindElement(By.Id("AddressStreet"));
street.SendKeys("Tramstrasse 10");
driver.FindElement(By.Id("btnContinue")).Click();
driver.FindElement(By.Id("btnSave")).Click();
driver.Quit();
Can anyone solve my problem?
You can solve this problem by checking the DOM for a certain amount of time to try to find your WebElement. You can use Implicit or Explicit Waits.
Doc:
http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#explicit-waits http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#implicit-waits
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.