I am trying to automate a website with Selenium, however GetAttribute is behaving weirdly. Whatever element I try to getattributes, I get the error below. I am not sure why it would be trying to get something from the System.IO.
I isolated the code, tried using IWebDriver and ChromeDriver, nothing worked.
ChromeDriver chrome = new ChromeDriver(Util.Util.GetHomeDir() + "/eztools/drivers/");
chrome.Navigate().GoToUrl("https://dfe-portal.svrs.rs.gov.br/NFE/CCC");
Thread.Sleep(5000);
IWebElement el1 = chrome.FindElementById("CodUf");
Log.Debug("el1:" + el1);
Log.Debug("el2:" + el1.TagName);
Log.Debug("el2:" + el1.GetAttribute("data-val"));
Error:
em System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
em System.IO.Path.InternalGetDirectoryName(String path)
em OpenQA.Selenium.Internal.FileUtilities.GetCurrentDirectory()
em OpenQA.Selenium.Internal.ResourceUtilities.GetResourceStream(String fileName, String resourceId)
em OpenQA.Selenium.Remote.RemoteWebElement.GetAtom(String atomResourceName)
em OpenQA.Selenium.Remote.RemoteWebElement.GetAttribute(String attributeName)
em ezrpa_runner.Cmds.Logic.WebCaptcha.run(CommandDomain cmd) na C:\ez\vs2019\ez-inspect\ezrpa-runner\Cmds\Web\WebCaptcha.cs:linha 44