在我的 html 源代碼中,我需要檢索以單詞“ actionId ”開頭的標簽的所有值。
因此,應檢索Id以單詞“ action ”(“ action1 ”、“ action2 ”、“ action3 ”等)開頭的所有標簽。
到目前為止我的代碼:
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();
uj5u.com熱心網友回復:
driver.FindElements(By.XPath("//*[starts-with(@id,'action')]"))
將是所有以 xpath 的操作開頭的 id 標記。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/531043.html
標籤:C#硒
