In my html source code I need to retrieve all values of the Id
tag that starts with the word 'action'.
So all Id
tags that starts with the word 'action' ('action1', 'action2', 'action3' etc) should be retrieved.
My code so far:
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://hello/helloworld.aspx");
driver.Manage().Window.Maximize();
IWebElement element = driver.FindElement(By.Id("action"));
var id2 = element.GetAttribute("action");
driver.Close();
CodePudding user response:
driver.FindElements(By.XPath("//*[starts-with(@id,'action')]"))
would be all tags with id that starts with action for an xpath.