<commit_before>using OpenQA.Selenium;
using NSelene.Conditions;
using System.Drawing;
using OpenQA.Selenium.Interactions;
using System.Collections.ObjectModel;
using System;

namespace NSelene
{
    public interface WrapsWebElement
    {
        IWebElement ActualWebElement { get; }
    }

    // TODO: consider extracting SElement as interface... 
    public sealed class SeleneElement : WrapsWebElement, IWebElement, ISearchContext, SeleneContext
    {
        readonly SeleneLocator<IWebElement> locator;

        readonly SeleneDriver driver;
        private readonly _SeleneSettings_ config;

        internal SeleneElement(SeleneLocator<IWebElement> locator, SeleneDriver driver)
        {
            this.locator = locator;
            this.driver = driver;
            this.config = Configuration._With_(driver: driver.Value);
        }

        internal SeleneElement(By locator, SeleneDriver driver) 
            : this(new SearchContextWebElementSLocator(locator, driver), driver) {}

        internal SeleneElement(By locator) 
        : this(
            new SearchContextWebElementSLocator(locator, Selene.SharedSeleneDriver), 
            Selene.SharedSeleneDriver
        ) 
        {}

        internal SeleneElement(IWebElement elementToWrap, IWebDriver driver)
            : this(new WrappedWebElementSLocator(elementToWrap), new SeleneDriver(driver)) {}

        internal SeleneElement(By locator, _SeleneSettings_ config) 
        : this(locator)
        {
            this.config = config;
        }
        
        internal SeleneElement(SeleneLocator<IWebElement> locator, _SeleneSettings_ config) 
        : this(locator, Selene.SharedSeleneDriver)
        {
            this.config = config;
        }

        public SeleneElement With(
            double? timeout = null,
            double? pollDuringWaits = null,
            bool? setValueByJs = null
        )
        {
            return new SeleneElement(
                this.locator, 
                this.config.With(Configuration._With_(timeout:timeout))
            );
        }

        public SeleneElement _With_(_SeleneSettings_ config)
        {
            return new SeleneElement(
                this.locator, 
                config
            );
        }

        // TODO: consider making it just a field initialized in constructor
        Actions Actions {
            get {
                return this.driver.Actions();
            }
        }

        public IWebElement ActualWebElement {
            get {
                return locator.Find();
            }
        }

        public override string ToString()
        {
            return this.locator.Description;<commit_msg>fixed all options in SeleneElement.With<commit_after>using OpenQA.Selenium;
using NSelene.Conditions;
using System.Drawing;
using OpenQA.Selenium.Interactions;
using System.Collections.ObjectModel;
using System;

namespace NSelene
{
    public interface WrapsWebElement
    {
        IWebElement ActualWebElement { get; }
    }

    // TODO: consider extracting SElement as interface... 
    public sealed class SeleneElement : WrapsWebElement, IWebElement, ISearchContext, SeleneContext
    {
        readonly SeleneLocator<IWebElement> locator;

        readonly SeleneDriver driver;
        private readonly _SeleneSettings_ config;

        internal SeleneElement(SeleneLocator<IWebElement> locator, SeleneDriver driver)
        {
            this.locator = locator;
            this.driver = driver;
            this.config = Configuration._With_(driver: driver.Value);
        }

        internal SeleneElement(By locator, SeleneDriver driver) 
            : this(new SearchContextWebElementSLocator(locator, driver), driver) {}

        internal SeleneElement(By locator) 
        : this(
            new SearchContextWebElementSLocator(locator, Selene.SharedSeleneDriver), 
            Selene.SharedSeleneDriver
        ) 
        {}

        internal SeleneElement(IWebElement elementToWrap, IWebDriver driver)
            : this(new WrappedWebElementSLocator(elementToWrap), new SeleneDriver(driver)) {}

        internal SeleneElement(By locator, _SeleneSettings_ config) 
        : this(locator)
        {
            this.config = config;
        }
        
        internal SeleneElement(SeleneLocator<IWebElement> locator, _SeleneSettings_ config) 
        : this(locator, Selene.SharedSeleneDriver)
        {
            this.config = config;
        }

        public SeleneElement With(
            double? timeout = null,
            double? pollDuringWaits = null,
            bool? setValueByJs = null
        )
        {
            return new SeleneElement(
                this.locator, 
                this.config.With(Configuration._With_(
                    timeout:timeout,
                    pollDuringWaits:pollDuringWaits,
                    setValueByJs:setValueByJs
                ))
            );
        }

        public SeleneElement _With_(_SeleneSettings_ config)
        {
            return new SeleneElement(
                this.locator, 
                config
            );
        }

        // TODO: consider making it just a field initialized in constructor
        Actions Actions {
            get {
                return this.driver.Actions();
            }
        }

        public IWebElement ActualWebElement {
            get {
                return locator.Find();
            }
        }

        public override string ToString()
        {
            return this.locator.Description;
{'fraction_non_alphanumeric': 0.06696750902527075, 'fraction_numerical': 0.0, 'mean_word_length': 1.888946819603754, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1425943', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1387, 'n_words': 310}