This is my code in C# I press the delete button and open a pop up where I select the amount of deletions that I want to delete and press again on delete it will delete.
Perhaps it is more correct to ask how I do while this delete element:
PropertiesCollections.driver.FindElement (By.LinkText ("Delete")). Click ();
As long as it appear true that it will perform the deletion steps and if it does not continue the test:
PropertiesCollections.driver.FindElement(By.LinkText("Delete")).Click();
new SelectElement(PropertiesCollections.driver.FindElement(By.Id("remove_shares"))).SelectByText("1");
PropertiesCollections.driver.FindElement(By.XPath("(//button[@type='button'])[2]")).Click();
I want to make a loop if the delete button appear, it will do all the steps of the deletion, and if it does not continue for the other test.
I've tried with this code:
var links = PropertiesCollections.driver.FindElement(By.LinkText("Delete")).Click();
while (links = true)
{
PropertiesCollections.driver.FindElement(By.LinkText("Delete")).Click();
PropertiesCollections.driver.FindElement(By.Id("remove_shares"));
PropertiesCollections.driver.FindElement(By.XPath("(//button[@type='button'])[2]")).Click();
}
But I get an error:
Error 1 Cannot assign void to an implicitly-typed local variable