<commit_before>using System;
using System.Collections.ObjectModel;
using System.Drawing;

using OpenQA.Selenium;

namespace FluentBrowserAutomation
{
	public class RemoteWebElementWrapper
	{
		public RemoteWebElementWrapper(Func<IWebElement> howToGetIt, IWebElement webElement)
			: this(howToGetIt)
		{
			_remoteElement = webElement;
		}

		public RemoteWebElementWrapper(Func<IWebElement> howToGetIt)
		{
			_howToGetIt = howToGetIt;
		}

		private readonly Func<IWebElement> _howToGetIt;
		private IWebElement _remoteElement;
		private string _tagName;

		public void Clear()
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Clear();
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Clear();
			}
		}

		public void Click()
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Click();
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Click();
			}
		}

		public IWebElement FindElement(By @by)
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElement(@by);
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElement(@by);
			}
		}

// ReSharper disable once ReturnTypeCanBeEnumerable.Global
		public ReadOnlyCollection<IWebElement> FindElements(By @by)
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElements(@by);
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElements(@by);
			}
		}

		public string GetAttribute(string attributeName)
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.GetAttribute(attributeName);
			}
			catch (StaleElementReferenceException)
			{<commit_msg>fix redundant code identified by resharper<commit_after>using System;
using System.Collections.ObjectModel;
using System.Drawing;

using OpenQA.Selenium;

namespace FluentBrowserAutomation
{
	public class RemoteWebElementWrapper
	{
		public RemoteWebElementWrapper(Func<IWebElement> howToGetIt, IWebElement webElement)
			: this(howToGetIt)
		{
			_remoteElement = webElement;
		}

		public RemoteWebElementWrapper(Func<IWebElement> howToGetIt)
		{
			_howToGetIt = howToGetIt;
		}

		private readonly Func<IWebElement> _howToGetIt;
		private IWebElement _remoteElement;
		private string _tagName;

		public void Clear()
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Clear();
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Clear();
			}
		}

		public void Click()
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Click();
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				_remoteElement.Click();
			}
		}

		public IWebElement FindElement(By by)
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElement(by);
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElement(by);
			}
		}

// ReSharper disable once ReturnTypeCanBeEnumerable.Global
		public ReadOnlyCollection<IWebElement> FindElements(By by)
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElements(by);
			}
			catch (StaleElementReferenceException)
			{
				_remoteElement = null;
				TryEnsureExists();
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.FindElements(by);
			}
		}

		public string GetAttribute(string attributeName)
		{
			try
			{
				if (_remoteElement == null)
				{
					TryEnsureExists();
				}
// ReSharper disable once PossibleNullReferenceException
				return _remoteElement.GetAttribute(attributeName);
			}
			catch (StaleElementReferenceException)
			{
{'fraction_non_alphanumeric': 0.08143758363601605, 'fraction_numerical': 0.0, 'mean_word_length': 3.6465364120781527, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '975982', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1563, 'n_words': 315}