-1
我明白最好的辦法是使用 我PageFactory用於標識表中的行
SearchContext table = driver.FindElements(By.Xpath="xpath for the table");
List<IWebElement> allrows = table.FindElements(By.Tagname="tr");
但是,如果我們需要在頁面出廠設置來實現這一點,我們將如何去做。我用Google搜索,但所有的答案都爲正常的方法不使用PageFactory
到目前爲止,
PageFactory.InitElements(Driver, this); `Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));`
[FindsBy(How = How.XPath, Using = "//*[@id='MyGrid']/div[3]/div/table/tbody")] protected ISearchContext AccoProTable { get; set; }
我怎麼繼續使用AccProTable,而是在其搜索網頁。
我實現你的建議改變並以其良好的之一。簡單但有效,但現在我得到** [錯誤]異常已被調用的目標拋出。 - >成員類型List '1'不是IWebElement或IList **根據許多帖子,這似乎是一個.Net問題,但由於我們已經使用IList ,所提及的可能修復的範圍已完全耗盡。如果您有任何建議,歡迎。乾杯!! –