[英]how to find linkbutton value on clicking checkbox in datalist using c#?
[英]How to find checkbox value when using Appium C# driver?
我正在使用 C# Appium 驅動程序 AppiumDriver
需要獲取 iOS 設備上 ShowInMarkbookLocator 的復選框值
首先我試過
_driver.FindElement(ShowInMarkbookLocator).GetAttribute("checked")
它返回空字符串。
然后嘗試..
_driver.FindElement(ShowInMarkbookLocator).Selected
它給出了一個錯誤:
OpenQA.Selenium.WebDriverException : 未知錯誤(發生未知的服務器端錯誤。status='false'。無法完成內部方法:'elementGetProperty args: [NATIVE, xpath=(//[@text='Markbook']) [1], 0, selected]', 詳細信息:無法從 'xpath=(//[@text='Markbook'])[1]' 獲取屬性。無法連接到設備上的應用程序)
復選框定位器 ShowInMarkbookLocator 是正確的,我可以檢查它的啟用值
有沒有另一種方法來獲取復選框值?
您可以像這樣查詢CheckBox.IsChecked
的狀態:
string state = myAppiumWebElement.GetAttribute("Toggle.ToggleState");
“0”未選中
選中“1”
“2”未定義(例如對於沒有切換狀態的元素)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.