Using Selenium in Visual Studio. I'm writing a testcase where I first need to see if a specific element exist or not before I can proceed.
When I try to identify an element within a if-statement like this:
if (driver.FindElement(By.XPath("//lina-device-information/div[1]/div[2]/lina-list-wrapper[3]/div/div/lina-insurance-information")))
{
//Do stuff
}
else
{
//End test
}
I get an error: "Error CS0029 Cannot implicitly convert type 'OpenQA.Selenium.IWebElement' to 'bool' "
Is it not possible to use FindElement as a condition within a if-statement or what am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire