title: How can I create a method to get a string of an element and assert its changes
body: <p>I'm quite new to unit testing and c#.</p>
  <p>I have an area on a page with a url: <a href="https://www.testurl.com" rel="nofollow noreferrer">https://www.testurl.com</a> (example)</p>
  <p>I have a couple of tick boxes that can change the displayed url on the page.</p>
  <p>Example of tick boxes: Http, .net, testurl2</p>
  <p>There boxes will change the value of the url and i need to check if the url does change when those boxes are ticked.</p>
  <p>How can i create a method for the url so i can call it every  time a box is ticked and use an assert for the expected value?</p>
  <p>I have created a Method for the test url as follows:</p>
  <pre><code>void TestUrl()
              {
                  string url = driver.FindElement(By.CssSelector(&quot;div[class='ui action input'] input[type='text']&quot;)).Text;
                  
              }
  </code></pre>
  <p>And i tried to assert it this way (lets say, after clicking the http:// tick box, changing https:// to http://):</p>
  <pre><code>string httpUrl = &quot;http://testurl.com&quot;;
  Assert.AreEqual(httpUrl, TestUrl());
  </code></pre>
  <p>I get the following issue: Argument 2&gt; cannot convert from void to object.</p>
  <p>I understand the issue, but i cannot think on a way to get to use the method <code>TestUrl()</code> as i want to.</p>
  <p>Hopefully the question is clear, Using examples as i cannot use the urls i am working on as they are confidential.</p>