简体   繁体   中英

How to store Kendo dropdown value in variable using selenium c#

//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);
}

Above code is not working for me. Please help me out!

In log file, it is always displaying resulted data as below

"TestCase 3 is running unsuccessfully with Network".

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM