2017-09-14 55 views
0
//workflow 
if (((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[@id='chk_user_1']"))) != null) 
{ 
    File.AppendAllText(@"D:\TestingScript\Search Package\UnitTestProject1\Logs\TestDPS.txt", "TestCase 3 is running successfully with Network" + Environment.NewLine); 
} 

else 
{ 
    File.AppendAllText(@"D:\TestingScript\Search Package\UnitTestProject1\Logs\TestDPS.txt", "TestCase 3 is running unsuccessfully with Network" + Environment.NewLine); 
} 

上面的代碼不適用於我。請幫助我!如何在使用硒c的變量中存儲Kendo下拉值#

在日誌文件中,它總是顯示所產生的數據如下

「的TestCase 3與網絡運行失敗」。

+0

您需要存儲在一個列表'ID = chk_user_1'的所有元素,然後檢查列表的大小,然後把你的「空」登錄 – Kapil

回答

0
IList<IWebElement> all = driver.FindElements(By.id("chk_user_1")); 
int size = all.size(); 

if (size != 0) 
{ 
    File.AppendAllText(@"D:\TestingScript\Search Package\UnitTestProject1\Logs\TestDPS.txt", "TestCase 3 is running successfully with Network" + Environment.NewLine); 
} 

else 
{ 
    File.AppendAllText(@"D:\TestingScript\Search Package\UnitTestProject1\Logs\TestDPS.txt", "TestCase 3 is running unsuccessfully with Network" + Environment.NewLine); 
} 
+0

感謝您的幫助,我沒有檢查,現在因爲我不在城裏,但我會盡快讓你更新。現在接受這個答案。 –

相關問題