I'm trying to log information when I'm running my Selenium tests.
Here is some very simple sample code I am working with:
using System.Threading;
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
class EntryPoint
{
static void Main(string[] args)
{
string url = "http://testing.todorvachev.com/selectors/css-path/";
string cssPath = "#search-2 > form > label > input";
string xPath = "//*[@id=\"search-2\"]/form/label/input";
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl(url);
IWebElement cssPathElement = driver.FindElement(By.CssSelector(cssPath));
IWebElement xPathElement = driver.FindElement(By.XPath(xPath));
if (cssPathElement.Displayed)
{
Console.WriteLine("I can see the CSS path element");
}
else
{
Console.WriteLine("I can't see it");
}
driver.Quit();
}
}
I understand that Selenium has various logging levels (https://raw.githubusercontent.com/wiki/SeleniumHQ/selenium/DesiredCapabilities.md) and I'd just like to learn how to implement them from the command line.
I have been trying different variations of the following, with no luck:
C:\Users\sandra\Desktop\WSD\SeleniumPractice\SetupEnvironment\SetupEnvironment\bin\Debug>SetupEnvironment.exe -log C:\temp\log
The command runs fine, and gives this output:
Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 58605
Only local connections are allowed.
I can see the CSS path element
Nothing gets written to the file I specified in the command.